ledger-core
|
Enumerations | |
enum | Endianness { BIG = 1, LITTLE } |
Functions | |
Endianness | getSystemEndianness () |
bool | isSystemBigEndian () |
bool | isSystemLittleEndian () |
void * | swapToBigEndian (void *ptr, size_t size) |
void * | swapToLittleEndian (void *ptr, size_t size) |
void * | swapToEndianness (void *ptr, size_t size, Endianness current, Endianness final) |
const void * | int_to_array (int i, Endianness endianness) |
const void * | unsigned_long_long_to_array (unsigned long long i, Endianness endianness) |
template<typename T > | |
void * | scalar_type_to_array (T i, Endianness endianness) |
Endianness management functions
Endianness ledger::core::endianness::getSystemEndianness | ( | ) |
Checks if the current system uses big endian or little bytes order.
bool ledger::core::endianness::isSystemBigEndian | ( | ) |
Returns true if the current runtime uses big endian bytes order.
bool ledger::core::endianness::isSystemLittleEndian | ( | ) |
Returns true if the current runtime uses little endian bytes order.
void * ledger::core::endianness::swapToBigEndian | ( | void * | ptr, |
size_t | size | ||
) |
Swaps ptr bytes to big endian bytes order if the current runtime uses little endia bytes order.
ptr | The buffer to force in big endian bytes order |
size | The size of the buffer |
void * ledger::core::endianness::swapToEndianness | ( | void * | ptr, |
size_t | size, | ||
Endianness | current, | ||
Endianness | final | ||
) |
Swaps ptr bytes to final endianness only if necessary
ptr | The buffer to force in "final" endianness |
size | The size of the buffer |
current | The current byte order of ptr |
final | The desired final byte order of ptr |
void * ledger::core::endianness::swapToLittleEndian | ( | void * | ptr, |
size_t | size | ||
) |
Swaps ptr bytes to little endian bytes order if the current runtime uses big endia bytes order.
ptr | The buffer to force in little endian bytes order |
size | The size of the buffer |