libusual
0.1
|
Endianess conversion, convert integers to bytes. More...
Defines | |
Convert host-endian int to BE/LE. | |
#define | htobe16(x) |
Convert native 16-bit int to big-endian. | |
#define | htobe32(x) |
Convert native 32-bit int to big-endian. | |
#define | htobe64(x) |
Convert native 64-bit int to big-endian. | |
#define | htole16(x) |
Convert native 16-bit int to little-endian. | |
#define | htole32(x) |
Convert native 32-bit int to little-endian. | |
#define | htole64(x) |
Convert native 64-bit int to little-endian. | |
#define | be16toh(x) |
Convert big-endian 16-bit int to host-endian. | |
#define | be32toh(x) |
Convert big-endian 32-bit int to host-endian. | |
#define | be64toh(x) |
Convert big-endian 64-bit int to host-endian. | |
#define | le16toh(x) |
Convert little-endian 64-bit int to host-endian. | |
#define | le32toh(x) |
Convert little-endian 64-bit int to host-endian. | |
#define | le64toh(x) |
Convert little-endian 64-bit int to host-endian. | |
Functions | |
Always swap. | |
static uint16_t | bswap16 (uint16_t x) |
Swap 16-bit int. | |
static uint32_t | bswap32 (uint32_t x) |
Swap 32-bit int. | |
static uint64_t | bswap64 (uint64_t x) |
Swap 64-bit int. | |
Read integer values from memory and convert to host format. | |
static uint16_t | be16dec (const void *p) |
Read big-endian 16-bit int from memory. | |
static uint32_t | be32dec (const void *p) |
Read big-endian 32-bit int from memory. | |
static uint64_t | be64dec (const void *p) |
Read big-endian 64-bit int from memory. | |
static uint16_t | le16dec (const void *p) |
Read little-endian 16-bit int from memory. | |
static uint32_t | le32dec (const void *p) |
Read little-endian 32-bit int from memory. | |
static uint64_t | le64dec (const void *p) |
Read little-endian 64-bit int from memory. | |
static uint16_t | h16dec (const void *p) |
Read host-endian 16-bit int from memory. | |
static uint32_t | h32dec (const void *p) |
Read host-endian 32-bit int from memory. | |
static uint64_t | h64dec (const void *p) |
Read host-endian 64-bit int from memory. | |
Convert host value to LE/BE and write to memory | |
static void | be16enc (void *p, uint16_t x) |
Write big-endian 16-bit int to memory. | |
static void | be32enc (void *p, uint32_t x) |
Write big-endian 32-bit int to memory. | |
static void | be64enc (void *p, uint64_t x) |
Write big-endian 64-bit int to memory. | |
static void | le16enc (void *p, uint16_t x) |
Write little-endian 16-bit int to memory. | |
static void | le32enc (void *p, uint32_t x) |
Write little-endian 32-bit int to memory. | |
static void | le64enc (void *p, uint64_t x) |
Write little-endian 64-bit int to memory. | |
static void | h16enc (void *p, uint16_t x) |
Write host-endian 16-bit int to memory. | |
static void | h32enc (void *p, uint32_t x) |
Write host-endian 32-bit int to memory. | |
static void | h64enc (void *p, uint64_t x) |
Write host-endian 64-bit int to memory. |
Endianess conversion, convert integers to bytes.
#define htobe16 | ( | x | ) |
#define htobe32 | ( | x | ) |
#define htobe64 | ( | x | ) |
#define htole16 | ( | x | ) |
#define htole32 | ( | x | ) |
#define htole64 | ( | x | ) |
#define be16toh | ( | x | ) |
Convert big-endian 16-bit int to host-endian.
#define be32toh | ( | x | ) |
Convert big-endian 32-bit int to host-endian.
#define be64toh | ( | x | ) |
Convert big-endian 64-bit int to host-endian.
#define le16toh | ( | x | ) |
Convert little-endian 64-bit int to host-endian.
#define le32toh | ( | x | ) |
Convert little-endian 64-bit int to host-endian.
#define le64toh | ( | x | ) |
Convert little-endian 64-bit int to host-endian.
static uint16_t bswap16 | ( | uint16_t | x | ) | [inline, static] |
Swap 16-bit int.
static uint16_t be16dec | ( | const void * | p | ) | [inline, static] |
Read big-endian 16-bit int from memory.
References htobe16.
static uint32_t be32dec | ( | const void * | p | ) | [inline, static] |
Read big-endian 32-bit int from memory.
References htobe32.
static uint64_t be64dec | ( | const void * | p | ) | [inline, static] |
Read big-endian 64-bit int from memory.
References htobe64.
static uint16_t le16dec | ( | const void * | p | ) | [inline, static] |
Read little-endian 16-bit int from memory.
References htole16.
static uint32_t le32dec | ( | const void * | p | ) | [inline, static] |
Read little-endian 32-bit int from memory.
References htole32.
static uint64_t le64dec | ( | const void * | p | ) | [inline, static] |
Read little-endian 64-bit int from memory.
References htole64.
static uint16_t h16dec | ( | const void * | p | ) | [inline, static] |
Read host-endian 16-bit int from memory.
static uint32_t h32dec | ( | const void * | p | ) | [inline, static] |
Read host-endian 32-bit int from memory.
static uint64_t h64dec | ( | const void * | p | ) | [inline, static] |
Read host-endian 64-bit int from memory.
static void be16enc | ( | void * | p, |
uint16_t | x | ||
) | [inline, static] |
Write big-endian 16-bit int to memory.
References htobe16.
static void be32enc | ( | void * | p, |
uint32_t | x | ||
) | [inline, static] |
Write big-endian 32-bit int to memory.
References htobe32.
static void be64enc | ( | void * | p, |
uint64_t | x | ||
) | [inline, static] |
Write big-endian 64-bit int to memory.
References htobe64.
static void le16enc | ( | void * | p, |
uint16_t | x | ||
) | [inline, static] |
Write little-endian 16-bit int to memory.
References htole16.
static void le32enc | ( | void * | p, |
uint32_t | x | ||
) | [inline, static] |
Write little-endian 32-bit int to memory.
References htole32.
static void le64enc | ( | void * | p, |
uint64_t | x | ||
) | [inline, static] |
Write little-endian 64-bit int to memory.
References htole64.
static void h16enc | ( | void * | p, |
uint16_t | x | ||
) | [inline, static] |
Write host-endian 16-bit int to memory.
static void h32enc | ( | void * | p, |
uint32_t | x | ||
) | [inline, static] |
Write host-endian 32-bit int to memory.
static void h64enc | ( | void * | p, |
uint64_t | x | ||
) | [inline, static] |
Write host-endian 64-bit int to memory.