XII Release 0.1.0
Loading...
Searching...
No Matches
xiiEndianHelper 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.
 
static bool IsLittleEndian ()
 Returns true if called on a little endian system, false otherwise.
 
static void SwitchWords (xiiUInt16 *pWords, xiiUInt32 uiCount)
 Switches endianess of the given array of words (16 bit values).
 
static void SwitchDWords (xiiUInt32 *pDWords, xiiUInt32 uiCount)
 Switches endianess of the given array of double words (32 bit values).
 
static void SwitchQWords (xiiUInt64 *pQWords, xiiUInt32 uiCount)
 Switches endianess of the given array of quad words (64 bit values).
 
static XII_ALWAYS_INLINE xiiUInt16 Switch (xiiUInt16 uiWord)
 Returns a single switched word (16 bit value).
 
static XII_ALWAYS_INLINE xiiUInt32 Switch (xiiUInt32 uiDWord)
 Returns a single switched double word (32 bit value).
 
static XII_ALWAYS_INLINE xiiUInt64 Switch (xiiUInt64 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.
 
template<typename T>
static void SwitchStruct (T *pDataPointer, const char *szFormat)
 Templated helper method for SwitchStruct.
 
static void SwitchStructs (void *pDataPointer, const char *szFormat, xiiUInt32 uiStride, xiiUInt32 uiCount)
 Switches a given set of struct according to the layout described in the szFormat parameter.
 
template<typename T>
static void SwitchStructs (T *pDataPointer, const char *szFormat, xiiUInt32 uiCount)
 Templated helper method for SwitchStructs.
 

Detailed Description

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

Member Function Documentation

◆ IsBigEndian()

static bool xiiEndianHelper::IsBigEndian ( )
inlinestatic

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

Note
Note that usually the compile time decisions with the defines XII_PLATFORM_LITTLE_ENDIAN, XII_PLATFORM_BIG_ENDIAN is preferred.

◆ IsLittleEndian()

static bool xiiEndianHelper::IsLittleEndian ( )
inlinestatic

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

Note
Note that usually the compile time decisions with the defines XII_PLATFORM_LITTLE_ENDIAN, XII_PLATFORM_BIG_ENDIAN is preferred.

◆ SwitchStruct()

void xiiEndianHelper::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, xiiUInt16)
  • d for a member of 4 bytes (DWORD, xiiUInt32)
  • q for a member of 8 bytes (DWORD, xiiUInt64)

◆ SwitchStructs()

void xiiEndianHelper::SwitchStructs ( void * pDataPointer,
const char * szFormat,
xiiUInt32 uiStride,
xiiUInt32 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, xiiUInt16)
  • d for a member of 4 bytes (DWORD, xiiUInt32)
  • q for a member of 8 bytes (DWORD, xiiUInt64)

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