ezEngine  Milestone 7
ezEndianHelper Struct Reference

Collection of helper methods when working with endianess "problems". More...

#include <EndianHelper.h>

Static Public Member Functions

static bool IsBigEndian ()
 Returns true if called on a big endian system, false otherwise. More...
 
static bool IsLittleEndian ()
 Returns true if called on a little endian system, false otherwise. More...
 
static void SwitchWords (ezUInt16 *pWords, ezUInt32 uiCount)
 Switches endianess of the given array of words (16 bit values).
 
static void SwitchDWords (ezUInt32 *pDWords, ezUInt32 uiCount)
 Switches endianess of the given array of double words (32 bit values).
 
static void SwitchQWords (ezUInt64 *pQWords, ezUInt32 uiCount)
 Switches endianess of the given array of quad words (64 bit values).
 
static EZ_FORCE_INLINE ezUInt16 Switch (ezUInt16 uiWord)
 Returns a single switched word (16 bit value).
 
static EZ_FORCE_INLINE ezUInt32 Switch (ezUInt32 uiDWord)
 Returns a single switched double word (32 bit value).
 
static EZ_FORCE_INLINE ezUInt64 Switch (ezUInt64 uiQWord)
 Returns a single switched quad word (64 bit value).
 
template<typename T >
static void SwitchInPlace (T *pValue)
 Switches a value in place (template accepts pointers for 2, 4 & 8 byte data types)
 
static void SwitchStruct (void *pDataPointer, const char *szFormat)
 Switches a given struct according to the layout described in the szFormat parameter. More...
 
template<typename T >
static void SwitchStruct (T *pDataPointer, const char *szFormat)
 Templated helper method for SwitchStruct.
 
static void SwitchStructs (void *pDataPointer, const char *szFormat, ezUInt32 uiStride, ezUInt32 uiCount)
 Switches a given set of struct according to the layout described in the szFormat parameter. More...
 
template<typename T >
static void SwitchStructs (T *pDataPointer, const char *szFormat, ezUInt32 uiCount)
 Templated helper method for SwitchStructs.
 

Detailed Description

Collection of helper methods when working with endianess "problems".

Member Function Documentation

static bool ezEndianHelper::IsBigEndian ( )
inlinestatic

Returns true if called on a big endian system, false otherwise.

Note
Note that usually the compile time decisions with the defines EZ_PLATFORM_LITTLE_ENDIAN, EZ_PLATFORM_BIG_ENDIAN is preferred.
static bool ezEndianHelper::IsLittleEndian ( )
inlinestatic

Returns true if called on a little endian system, false otherwise.

Note
Note that usually the compile time decisions with the defines EZ_PLATFORM_LITTLE_ENDIAN, EZ_PLATFORM_BIG_ENDIAN is preferred.
void ezEndianHelper::SwitchStruct ( void *  pDataPointer,
const char *  szFormat 
)
static

Switches a given struct according to the layout described in the szFormat parameter.

The format string may contain the characters:

  • c, b for a member of 1 byte
  • w, s for a member of 2 bytes (word, ezUInt16)
  • d for a member of 4 bytes (dword, ezUInt32)
  • q for a member of 8 bytes (qword, ezUInt64)
void ezEndianHelper::SwitchStructs ( void *  pDataPointer,
const char *  szFormat,
ezUInt32  uiStride,
ezUInt32  uiCount 
)
static

Switches a given set of struct according to the layout described in the szFormat parameter.

The format string may contain the characters:

  • c, b for a member of 1 byte
  • w, s for a member of 2 bytes (word, ezUInt16)
  • d for a member of 4 bytes (dword, ezUInt32)
  • q for a member of 8 bytes (qword, ezUInt64)

The documentation for this struct was generated from the following files: