Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Ult::Endian Class Reference

#include <Endian.h>

Public Member Functions

 Endian ()
 
virtual ~Endian ()
 
void ResolveEndian (char *data, size_t size, EndianType inputEndian) const
 
void SwapBytes (char *data, size_t size) const
 
void SwapBytes (char *data, size_t size, size_t number) const
 
EndianType GetEndianType () const
 

Detailed Description

Object used to figure out the system's endianness and switch value endianness if necessary.

Constructor & Destructor Documentation

◆ Endian()

Ult::Endian::Endian ( )

Endian constructor.

◆ ~Endian()

Ult::Endian::~Endian ( )
virtual

Endian destructor.

Member Function Documentation

◆ GetEndianType()

EndianType Ult::Endian::GetEndianType ( ) const
inline

Get the endianness of the host system

◆ ResolveEndian()

void Ult::Endian::ResolveEndian ( char * data,
size_t size,
EndianType inputEndian ) const

Switch endianness of the input data only if necessary based on the system endianness and the input endianness.

Parameters
dataThe bytes to be potentially switched endianness of
sizeThe number of bytes (should be multiple of 2)
inputEndianThe endianness of the input data

◆ SwapBytes() [1/2]

void Ult::Endian::SwapBytes ( char * data,
size_t size ) const

Reverse the byte order of a single value.

Parameters
dataThe bytes to swap the endianness of
sizeThe amount of bytes of data (e.g. 2,4,8)

◆ SwapBytes() [2/2]

void Ult::Endian::SwapBytes ( char * data,
size_t size,
size_t number ) const

Reverse the byte order of multiple values.

Parameters
dataThe bytes to swap the endianness of
sizeThe amount of bytes of a single value
numberThe number of values contained in data

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