Byte-swapping functions
kswap.h contains functions that will help converting 16, 32 and 64 bit length data between little-endian and big-endian representations.
More...
|
Functions |
void | KFromToBigEndian (Q_INT64 *out, Q_INT64 *in, uint len) |
Q_INT64 | KFromToBigEndian (Q_INT64 b) |
void | KFromToBigEndian (Q_INT32 *out, Q_INT32 *in, uint len) |
Q_INT32 | KFromToBigEndian (Q_INT32 b) |
void | KFromToBigEndian (Q_INT16 *out, Q_INT16 *in, uint len) |
Q_INT16 | KFromToBigEndian (Q_INT16 b) |
void | KFromToBigEndian (Q_UINT64 *out, Q_UINT64 *in, uint len) |
Q_UINT64 | KFromToBigEndian (Q_UINT64 b) |
void | KFromToBigEndian (Q_UINT32 *out, Q_UINT32 *in, uint len) |
Q_UINT32 | KFromToBigEndian (Q_UINT32 b) |
void | KFromToBigEndian (Q_UINT16 *out, Q_UINT16 *in, uint len) |
Q_UINT16 | KFromToBigEndian (Q_UINT16 b) |
void | KFromToLittleEndian (Q_INT64 *out, Q_INT64 *in, uint len) |
Q_INT64 | KFromToLittleEndian (Q_INT64 b) |
void | KFromToLittleEndian (Q_INT32 *out, Q_INT32 *in, uint len) |
Q_INT32 | KFromToLittleEndian (Q_INT32 b) |
void | KFromToLittleEndian (Q_INT16 *out, Q_INT16 *in, uint len) |
Q_INT16 | KFromToLittleEndian (Q_INT16 b) |
void | KFromToLittleEndian (Q_UINT64 *out, Q_UINT64 *in, uint len) |
Q_UINT64 | KFromToLittleEndian (Q_UINT64 b) |
void | KFromToLittleEndian (Q_UINT32 *out, Q_UINT32 *in, uint len) |
Q_UINT32 | KFromToLittleEndian (Q_UINT32 b) |
void | KFromToLittleEndian (Q_UINT16 *out, Q_UINT16 *in, uint len) |
Q_UINT16 | KFromToLittleEndian (Q_UINT16 b) |
Detailed Description
kswap.h contains functions that will help converting 16, 32 and 64 bit length data between little-endian and big-endian representations.
The KSWAP_16, KSWAP_32 and KSWAP_64 functions are always swaps the byte order of the supplied argument (which should be 16, 32 or 64 bit wide). These functions are inline, and tries to use the most optimized function of the underlying system (bswap_xx functions from byteswap.h in GLIBC, or ntohs and ntohl on little-endian machines, and if neither are applicable, some fast custom code).
The KFromTo{Little|Big}Endian functions are for converting big-endian and little-endian data to and from the machine endianness.
Function Documentation
void KFromToBigEndian |
( |
Q_INT64 * |
out, |
|
|
Q_INT64 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 64 bit signed array from/to big-endian byte order to/from the machine order.
Definition at line 263 of file kswap.h.
Q_INT64 KFromToBigEndian |
( |
Q_INT64 |
b |
) |
[inline] |
Converts a 64 bit signed value from/to big-endian byte order to/from the machine order.
Definition at line 250 of file kswap.h.
void KFromToBigEndian |
( |
Q_INT32 * |
out, |
|
|
Q_INT32 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 32 bit signed array from/to big-endian byte order to/from the machine order.
Definition at line 237 of file kswap.h.
Q_INT32 KFromToBigEndian |
( |
Q_INT32 |
b |
) |
[inline] |
Converts a 32 bit signed value from/to big-endian byte order to/from the machine order.
Definition at line 224 of file kswap.h.
void KFromToBigEndian |
( |
Q_INT16 * |
out, |
|
|
Q_INT16 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 16 bit signed array from/to big-endian byte order to/from the machine order.
Definition at line 211 of file kswap.h.
Q_INT16 KFromToBigEndian |
( |
Q_INT16 |
b |
) |
[inline] |
Converts a 16 bit signed value from/to big-endian byte order to/from the machine order.
Definition at line 198 of file kswap.h.
void KFromToBigEndian |
( |
Q_UINT64 * |
out, |
|
|
Q_UINT64 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 64 bit unsigned array from/to big-endian byte order to/from the machine order.
Definition at line 185 of file kswap.h.
Q_UINT64 KFromToBigEndian |
( |
Q_UINT64 |
b |
) |
[inline] |
Converts a 64 bit unsigned value from/to big-endian byte order to/from the machine order.
Definition at line 172 of file kswap.h.
void KFromToBigEndian |
( |
Q_UINT32 * |
out, |
|
|
Q_UINT32 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 32 bit unsigned array from/to big-endian byte order to/from the machine order.
Definition at line 159 of file kswap.h.
Q_UINT32 KFromToBigEndian |
( |
Q_UINT32 |
b |
) |
[inline] |
Converts a 32 bit unsigned value from/to big-endian byte order to/from the machine order.
Definition at line 146 of file kswap.h.
void KFromToBigEndian |
( |
Q_UINT16 * |
out, |
|
|
Q_UINT16 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 16 bit unsigned array from/to big-endian byte order to/from the machine order.
Definition at line 133 of file kswap.h.
Q_UINT16 KFromToBigEndian |
( |
Q_UINT16 |
b |
) |
[inline] |
Converts a 16 bit unsigned value from/to big-endian byte order to/from the machine order.
Definition at line 120 of file kswap.h.
void KFromToLittleEndian |
( |
Q_INT64 * |
out, |
|
|
Q_INT64 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 64 bit signed array from/to little-endian byte order to/from the machine order.
Definition at line 419 of file kswap.h.
Q_INT64 KFromToLittleEndian |
( |
Q_INT64 |
b |
) |
[inline] |
Converts a 64 bit signed value from/to little-endian byte order to/from the machine order.
Definition at line 406 of file kswap.h.
void KFromToLittleEndian |
( |
Q_INT32 * |
out, |
|
|
Q_INT32 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 32 bit signed array from/to little-endian byte order to/from the machine order.
Definition at line 393 of file kswap.h.
Q_INT32 KFromToLittleEndian |
( |
Q_INT32 |
b |
) |
[inline] |
Converts a 32 bit signed value from/to little-endian byte order to/from the machine order.
Definition at line 380 of file kswap.h.
void KFromToLittleEndian |
( |
Q_INT16 * |
out, |
|
|
Q_INT16 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 16 bit signed array from/to little-endian byte order to/from the machine order.
Definition at line 367 of file kswap.h.
Q_INT16 KFromToLittleEndian |
( |
Q_INT16 |
b |
) |
[inline] |
Converts a 16 bit signed value from/to little-endian byte order to/from the machine order.
Definition at line 354 of file kswap.h.
void KFromToLittleEndian |
( |
Q_UINT64 * |
out, |
|
|
Q_UINT64 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 64 bit unsigned array from/to little-endian byte order to/from the machine order.
Definition at line 341 of file kswap.h.
Q_UINT64 KFromToLittleEndian |
( |
Q_UINT64 |
b |
) |
[inline] |
Converts a 64 bit unsigned value from/to little-endian byte order to/from the machine order.
Definition at line 328 of file kswap.h.
void KFromToLittleEndian |
( |
Q_UINT32 * |
out, |
|
|
Q_UINT32 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 32 bit unsigned array from/to little-endian byte order to/from the machine order.
Definition at line 315 of file kswap.h.
Q_UINT32 KFromToLittleEndian |
( |
Q_UINT32 |
b |
) |
[inline] |
Converts a 32 bit unsigned value from/to little-endian byte order to/from the machine order.
Definition at line 302 of file kswap.h.
void KFromToLittleEndian |
( |
Q_UINT16 * |
out, |
|
|
Q_UINT16 * |
in, |
|
|
uint |
len | |
|
) |
| | [inline] |
Converts a 16 bit unsigned array from/to little-endian byte order to/from the machine order.
Definition at line 289 of file kswap.h.
Q_UINT16 KFromToLittleEndian |
( |
Q_UINT16 |
b |
) |
[inline] |
Converts a 16 bit unsigned value from/to little-endian byte order to/from the machine order.
Definition at line 276 of file kswap.h.