![]() |
ATLAS Offline Software
|
Write 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) |
void | CxxUtils::set_unaligned16 (uint8_t *ATH_RESTRICT &p, uint16_t val) |
Write a 2-byte little-endian value to a possibly unaligned pointer. More... | |
void | CxxUtils::set_unaligned32 (uint8_t *ATH_RESTRICT &p, uint32_t val) |
Write a 4-byte little-endian value to a possibly unaligned pointer. More... | |
void | CxxUtils::set_unaligned64 (uint8_t *ATH_RESTRICT &p, uint64_t val) |
Write an 8-byte little-endian value to a possibly unaligned pointer. More... | |
void | CxxUtils::set_unaligned_float (uint8_t *ATH_RESTRICT &p, float val) |
Write a little-endian float value to a possibly unaligned pointer. More... | |
void | CxxUtils::set_unaligned_double (uint8_t *ATH_RESTRICT &p, double val) |
Write a little-endian double value to a possibly unaligned pointer. More... | |
template<class T > | |
void | CxxUtils::set_unaligned (uint8_t *ATH_RESTRICT &p, T val) |
Define templated versions of the above functions. More... | |
template<> | |
void | CxxUtils::set_unaligned< uint8_t > (uint8_t *ATH_RESTRICT &p, uint8_t val) |
template<> | |
void | CxxUtils::set_unaligned< uint16_t > (uint8_t *ATH_RESTRICT &p, uint16_t val) |
template<> | |
void | CxxUtils::set_unaligned< uint32_t > (uint8_t *ATH_RESTRICT &p, uint32_t val) |
template<> | |
void | CxxUtils::set_unaligned< uint64_t > (uint8_t *ATH_RESTRICT &p, uint64_t val) |
template<> | |
void | CxxUtils::set_unaligned< float > (uint8_t *ATH_RESTRICT &p, float f) |
template<> | |
void | CxxUtils::set_unaligned< double > (uint8_t *ATH_RESTRICT &p, double f) |
template<> | |
void | CxxUtils::set_unaligned< int8_t > (uint8_t *ATH_RESTRICT &p, int8_t val) |
template<> | |
void | CxxUtils::set_unaligned< int16_t > (uint8_t *ATH_RESTRICT &p, int16_t val) |
template<> | |
void | CxxUtils::set_unaligned< int32_t > (uint8_t *ATH_RESTRICT &p, int32_t val) |
template<> | |
void | CxxUtils::set_unaligned< int64_t > (uint8_t *ATH_RESTRICT &p, int64_t val) |
Write 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 writing little-endian data via possibly unaligned pointers regardless of the host byte ordering and without relying on undefined behavior.
Definition in file set_unaligned.h.