ATLAS Offline Software
|
Read little-endian values through possibly unaligned pointers. More...
Go to the source code of this file.
Namespaces | |
CxxUtils | |
Functions | |
uint16_t | CxxUtils::htole16 (uint16_t x) |
uint32_t | CxxUtils::htole32 (uint32_t x) |
uint64_t | CxxUtils::htole64 (uint64_t x) |
uint16_t | CxxUtils::get_unaligned16 (const uint8_t *ATH_RESTRICT &p) |
Read a 2-byte little-endian value from a possibly unaligned pointer. More... | |
uint32_t | CxxUtils::get_unaligned32 (const uint8_t *ATH_RESTRICT &p) |
Read a 4-byte little-endian value from a possibly unaligned pointer. More... | |
uint64_t | CxxUtils::get_unaligned64 (const uint8_t *ATH_RESTRICT &p) |
Read a 8-byte little-endian value from a possibly unaligned pointer. More... | |
float | CxxUtils::get_unaligned_float (const uint8_t *ATH_RESTRICT &p) |
Read little-endian float value from a possibly unaligned pointer. More... | |
double | CxxUtils::get_unaligned_double (const uint8_t *ATH_RESTRICT &p) |
Read little-endian float value from a possibly unaligned pointer. More... | |
template<class T > | |
T | CxxUtils::get_unaligned (const uint8_t *ATH_RESTRICT &p) |
Define templated versions of the above functions. More... | |
template<> | |
uint8_t | CxxUtils::get_unaligned< uint8_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
uint16_t | CxxUtils::get_unaligned< uint16_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
uint32_t | CxxUtils::get_unaligned< uint32_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
uint64_t | CxxUtils::get_unaligned< uint64_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
float | CxxUtils::get_unaligned< float > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
double | CxxUtils::get_unaligned< double > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
int8_t | CxxUtils::get_unaligned< int8_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
int16_t | CxxUtils::get_unaligned< int16_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
int32_t | CxxUtils::get_unaligned< int32_t > (const uint8_t *ATH_RESTRICT &p) |
template<> | |
int64_t | CxxUtils::get_unaligned< int64_t > (const uint8_t *ATH_RESTRICT &p) |
Read little-endian values through possibly unaligned pointers.
is undefined if p
isn't aligned to an int boundary. It further will read the value using the host endianness, which is an issue for the common use case of reading persistent data.
The functions here allow reading little-endian data via possibly unaligned pointers regardless of the host byte ordering and without relying on undefined behavior.
Definition in file get_unaligned.h.