Plasma Engine  2.0
Loading...
Searching...
No Matches
plEndianHelper 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 (plUInt16 *pWords, plUInt32 uiCount)
 Switches endianess of the given array of words (16 bit values).
 
static void SwitchDWords (plUInt32 *pDWords, plUInt32 uiCount)
 Switches endianess of the given array of double words (32 bit values).
 
static void SwitchQWords (plUInt64 *pQWords, plUInt32 uiCount)
 Switches endianess of the given array of quad words (64 bit values).
 
static PL_ALWAYS_INLINE plUInt16 Switch (plUInt16 uiWord)
 Returns a single switched word (16 bit value).
 
static PL_ALWAYS_INLINE plUInt32 Switch (plUInt32 uiDWord)
 Returns a single switched double word (32 bit value).
 
static PL_ALWAYS_INLINE plUInt64 Switch (plUInt64 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, plUInt32 uiStride, plUInt32 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, plUInt32 uiCount)
 Templated helper method for SwitchStructs.
 

Detailed Description

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

Member Function Documentation

◆ IsBigEndian()

static bool plEndianHelper::IsBigEndian ( )
inlinestatic

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

Note
Note that usually the compile time decisions with the defines PL_PLATFORM_LITTLE_ENDIAN, PL_PLATFORM_BIG_ENDIAN is preferred.

◆ IsLittleEndian()

static bool plEndianHelper::IsLittleEndian ( )
inlinestatic

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

Note
Note that usually the compile time decisions with the defines PL_PLATFORM_LITTLE_ENDIAN, PL_PLATFORM_BIG_ENDIAN is preferred.

◆ SwitchStruct()

void plEndianHelper::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, plUInt16)
  • d for a member of 4 bytes (DWORD, plUInt32)
  • q for a member of 8 bytes (DWORD, plUInt64)

◆ SwitchStructs()

void plEndianHelper::SwitchStructs ( void * pDataPointer,
const char * szFormat,
plUInt32 uiStride,
plUInt32 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, plUInt16)
  • d for a member of 4 bytes (DWORD, plUInt32)
  • q for a member of 8 bytes (DWORD, plUInt64)

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