Burger::BigEndian Class Reference

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

#include <brendian.h>

Inheritance diagram for Burger::BigEndian:
Inheritance graph
[legend]
Collaboration diagram for Burger::BigEndian:
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 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 Word32 value 0x12345678 is stored in memory as 0x12, 0x34, 0x56, 0x78.

Examples of use:

    Word32 LoadedInt;

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

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