Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::LittleEndian Struct Reference

Loads a 16, 32 or 64 bit value with byte swapping if needed. More...

Inheritance diagram for Burger::LittleEndian:
Collaboration diagram for Burger::LittleEndian:

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.
 

Detailed Description

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:

uint32_t LoadedInt;
// Load 4 bytes from a file
fread(fp,1,4,&LoadedInt);
// Fetch the little endian data
uint32_t foo = Burger::LittleEndian::load(&LoadedInt);
static constexpr remove_pointer< T >::type load(T Input) noexcept
Load an arithmetic value endian swapped.
Definition burger.h:9056
Note
The documentation will describe the behavior of NativeEndian, be warned that it will map to SwapEndian on a big endian machine.
See also
NativeEndian, BigEndian and SwapEndian