Functions and macros for endian conversions and byteswap conversions.
|
#define | READ_LE_UINT16(a) READ_UINT16(a) |
|
#define | READ_LE_UINT32(a) READ_UINT32(a) |
|
#define | WRITE_LE_UINT16(a, v) WRITE_UINT16(a, v) |
|
#define | WRITE_LE_UINT32(a, v) WRITE_UINT32(a, v) |
|
#define | FROM_LE_32(a) ((uint32)(a)) |
|
#define | FROM_LE_16(a) ((uint16)(a)) |
|
#define | FROM_BE_32(a) SWAP_BYTES_32(a) |
|
#define | FROM_BE_16(a) SWAP_BYTES_16(a) |
|
#define | TO_LE_32(a) ((uint32)(a)) |
|
#define | TO_LE_16(a) ((uint16)(a)) |
|
#define | TO_BE_32(a) SWAP_BYTES_32(a) |
|
#define | TO_BE_16(a) SWAP_BYTES_16(a) |
|
#define | CONSTANT_LE_32(a) ((uint32)(a)) |
|
#define | CONSTANT_LE_16(a) ((uint16)(a)) |
|
#define | CONSTANT_BE_32(a) SWAP_CONSTANT_32(a) |
|
#define | CONSTANT_BE_16(a) SWAP_CONSTANT_16(a) |
|
#define | READ_LE_UINT64(a) READ_UINT64(a) |
|
#define | WRITE_LE_UINT64(a, v) WRITE_UINT64(a, v) |
|
#define | FROM_LE_64(a) ((uint64)(a)) |
|
#define | FROM_BE_64(a) SWAP_BYTES_64(a) |
|
#define | TO_LE_64(a) ((uint64)(a)) |
|
#define | TO_BE_64(a) SWAP_BYTES_64(a) |
|
#define | CONSTANT_LE_64(a) ((uint64)(a)) |
|
#define | CONSTANT_BE_64(a) SWAP_CONSTANT_64(a) |
|
|
Use these in case the unaligned load and byteswap take a lot of instructions.
|
uint16 | READ_BE_UINT16 (const void *ptr) |
|
uint32 | READ_BE_UINT32 (const void *ptr) |
|
void | WRITE_BE_UINT16 (void *ptr, uint16 value) |
|
void | WRITE_BE_UINT32 (void *ptr, uint32 value) |
|
uint64 | READ_BE_UINT64 (const void *ptr) |
|
void | WRITE_BE_UINT64 (void *ptr, uint64 value) |
|
uint32 | READ_LE_UINT24 (const void *ptr) |
|
void | WRITE_LE_UINT24 (void *ptr, uint32 value) |
|
uint32 | READ_BE_UINT24 (const void *ptr) |
|
void | WRITE_BE_UINT24 (void *ptr, uint32 value) |
|
| STATIC_ASSERT (sizeof(float)==sizeof(uint32), Unexpected_size_of_float) |
|
float | READ_LE_FLOAT32 (const void *ptr) |
|
void | WRITE_LE_FLOAT32 (void *ptr, float value) |
|
float | READ_BE_FLOAT32 (const void *ptr) |
|
void | WRITE_BE_FLOAT32 (void *ptr, float value) |
|
| STATIC_ASSERT (sizeof(double)==sizeof(uint64)||sizeof(double)==sizeof(uint32), Unexpected_size_of_double) |
|
template<size_t n> |
double | READ_DOUBLE (const SwapDouble &sw) |
|
template<size_t n> |
void | WRITE_DOUBLE (SwapDouble &sw, double d) |
|
template<> |
double | READ_DOUBLE< sizeof(uint64)> (const SwapDouble &sd) |
|
template<> |
void | WRITE_DOUBLE< sizeof(uint64)> (SwapDouble &sd, double d) |
|
template<> |
double | READ_DOUBLE< sizeof(uint32)> (const SwapDouble &sd) |
|
template<> |
void | WRITE_DOUBLE< sizeof(uint32)> (SwapDouble &sd, double d) |
|
double | READ_LE_FLOAT64 (const void *ptr) |
|
void | WRITE_LE_FLOAT64 (void *ptr, double value) |
|
double | READ_BE_FLOAT64 (const void *ptr) |
|
void | WRITE_BE_FLOAT64 (void *ptr, double value) |
|
double | READ_FPA_FLOAT64 (const void *ptr) |
|
void | WRITE_FPA_FLOAT64 (void *ptr, double value) |
|
double | READ_FLOAT64 (const void *ptr) |
|
void | WRITE_FLOAT64 (void *ptr, double value) |
|
int16 | READ_LE_INT16 (const void *ptr) |
|
void | WRITE_LE_INT16 (void *ptr, int16 value) |
|
int16 | READ_BE_INT16 (const void *ptr) |
|
void | WRITE_BE_INT16 (void *ptr, int16 value) |
|
int32 | READ_LE_INT32 (const void *ptr) |
|
void | WRITE_LE_INT32 (void *ptr, int32 value) |
|
int32 | READ_BE_INT32 (const void *ptr) |
|
void | WRITE_BE_INT32 (void *ptr, int32 value) |
|
#define | READ_UINT24(a) READ_LE_UINT24(a) |
|
#define | WRITE_UINT24(a, b) WRITE_LE_UINT24(a,b) |
|
#define | READ_FLOAT32(a) READ_LE_FLOAT32(a) |
|
#define | WRITE_FLOAT32(a, b) WRITE_LE_FLOAT32(a,b) |
|