Burger::LittleEndian Class Reference

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

#include <brendian.h>

Inheritance diagram for Burger::LittleEndian:
Inheritance graph
[legend]
Collaboration diagram for Burger::LittleEndian:
Collaboration graph
[legend]

List of all members.


Detailed Description

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

This class will map to either to Burger::NativeEndian or Burger::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 Word32 value 0x12345678 is stored in memory as 0x78, 0x56, 0x34, 0x12.

Examples of use:

    Word32 LoadedInt;

    // Load 4 bytes from a file
    fread(fp,1,4,&LoadedInt);

    // Fetch the little endian data
    Word32 foo = Burger::LittleEndian::Load(&LoadedInt);
Note:
The documentation will describe the behavior of Burger::NativeEndian, be warned that it will map to Burger::SwapEndian on a big endian machine.
See also:
Burger::NativeEndian, Burger::BigEndian and Burger::SwapEndian