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::BigEndian Struct Reference

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

Inheritance diagram for Burger::BigEndian:
Collaboration diagram for Burger::BigEndian:

Additional Inherited Members

- Static Public Member Functions inherited from Burger::NativeEndian
template<typename T >
static constexpr remove_pointer< T >::type load (T Input) noexcept
 Load an arithmetic value.
 
template<typename T >
static void store (T *pOutput, T Input) noexcept
 Store an arithmetic value.
 
template<typename T >
static void store (volatile T *pOutput, T Input) noexcept
 Store an arithmetic value to a volatile variable.
 
template<typename T >
static T load_unaligned (T *pInput) noexcept
 Fetch a value from memory with byte alignment.
 
template<typename T >
static void store_unaligned (T *pOutput, T Input) noexcept
 Store a 16 bit unsigned value to memory with byte alignment.
 
template<typename T >
static void fixup (T *) noexcept
 Does nothing.
 
template<typename T >
static void fixup_unaligned (T *) noexcept
 Does nothing.
 

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 big 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..

Big endian is considered true if the uint32_t value 0x12345678 is stored in memory as 0x12, 0x34, 0x56, 0x78.

Examples of use:

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