Loads a 16, 32 or 64 bit value with byte swapping if needed. More...
Additional Inherited Members | |
Static Public Member Functions inherited from Burger::SwapEndian | |
template<typename T > | |
static constexpr remove_pointer< T >::type | load (T Input) noexcept |
Load an arithmetic value endian swapped. | |
template<typename T > | |
static void | store (T *pOutput, T Input) noexcept |
Reverse the endian of stored arithmetic value. | |
template<typename T > | |
static void | store (volatile T *pOutput, T Input) noexcept |
Reverse the endian of volatile stored arithmetic value. | |
template<typename T > | |
static T | load_unaligned (T *pInput) noexcept |
Fetch a byte swapped value from memory with byte alignment. | |
template<typename T > | |
static void | store_unaligned (T *pOutput, T Input) noexcept |
Reverse the endian of unaligned stored arithmetic value. | |
template<typename T > | |
static void | fixup (T *pOutput) noexcept |
Swap the endian of a variable. | |
template<typename T > | |
static void | fixup (volatile T *pOutput) noexcept |
Swap the endian of a volatile variable. | |
template<typename T > | |
static void | fixup_unaligned (T *pOutput) noexcept |
Swap the endian of a variable that is byte aligned. | |
template<typename T > | |
static void | fixup_unaligned (volatile T *pOutput) noexcept |
Swap the endian of a volatile variable that is byte aligned. | |
Loads a 16, 32 or 64 bit value with byte swapping if needed.
This class will map to either to NativeEndian or SwapEndian depending on if this is a little endian machine or not. Use of this class will allow the programmer to write code that is endian neutral since the compiler will perform the proper mapping depending on the target's settings.
Little endian is considered true if the uint32_t value 0x12345678 is stored in memory as 0x78, 0x56, 0x34, 0x12.
Examples of use: