Swap the byte order of 16, 32 and 64 bit values. More...
Static Public Member Functions | |
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. | |
Swap the byte order of 16, 32 and 64 bit values.
When reading data from machines that are using different microprocessors, the byte order could be reversed. These functions will swap the byte order.
Whenever possible, these functions will use native CPU endian swap instructions for performance.
Swap the endian of a variable.
Read in the variable, swap the endian, and then store the result back in the original variable.
T | Pointer to a value to endian swap. |
pOutput | Pointer to the variable to endian swap |
Swap the endian of a volatile variable.
Read in the variable, swap the endian, and then store the result back in the original variable.
T | Pointer to a value to endian swap. |
pOutput | Pointer to the variable to endian swap |
Swap the endian of a variable that is byte aligned.
Read in the variable, swap the endian, and then store the result back in the original variable. This function works with values that are byte aligned.
T | Pointer to a value to endian swap. |
pOutput | Pointer to the variable to endian swap |
Swap the endian of a volatile variable that is byte aligned.
Read in the variable, swap the endian, and then store the result back in the original variable. This function works with values that are byte aligned.
T | Pointer to a value to endian swap. |
pOutput | Pointer to the variable to endian swap |
Load an arithmetic value endian swapped.
Given either an arithmetic type, or a pointer to an arithmetic type, load the value and return it with endian swapped.
If a non-arithmetic or pointer to non-arithmetic type is used, this template will throw a static assert.
T | Arithmetic type or pointer to arithmetic type. |
Input | The value to load from pointer or return endian swapped |
Fetch a byte swapped value from memory with byte alignment.
Assuming the data is unaligned, it will grab data a byte at a time and reconstruct it into a value in swapped endian.
T | arithmetic type. |
pInput | Pointer to a value. |
Reverse the endian of stored arithmetic value.
Given either an arithmetic type and its pointer, store the value endian swapped.
If a non-arithmetic or pointer to non-arithmetic type is used, this template will throw a static assert.
T | Arithmetic type |
pOutput | Pointer to a value to store as endian swapped |
Input | The arithmetic value to store endian swapped |
Reverse the endian of volatile stored arithmetic value.
Given either an arithmetic type and its pointer, store the value endian swapped.
If a non-arithmetic or pointer to non-arithmetic type is used, this template will throw a static assert.
T | Arithmetic type |
pOutput | Pointer to a value to store as endian swapped |
Input | The arithmetic value to store endian swapped |
Reverse the endian of unaligned stored arithmetic value.
It assumes that the output pointer is unaligned.
T | Pointer to a value to endian swap. |
pOutput | Pointer to a value to store as endian swapped |
Input | The arithmetic value to store endian swapped |