Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
cube_endian.hpp File Reference
#include <SDL2/SDL.h>
#include "inexor/shared/cube_types.hpp"

Go to the source code of this file.

Functions

ushort endianswap16 (ushort n)
 
uint endianswap32 (uint n)
 
ullong endianswap64 (ullong n)
 
template<class T >
endianswap (T n)
 
template<>
ushort endianswap< ushort > (ushort n)
 
template<>
short endianswap< short > (short n)
 
template<>
uint endianswap< uint > (uint n)
 
template<>
int endianswap< int > (int n)
 
template<>
ullong endianswap< ullong > (ullong n)
 
template<>
llong endianswap< llong > (llong n)
 
template<>
double endianswap< double > (double n)
 
template<class T >
void endianswap (T *buf, size_t len)
 
template<class T >
endiansame (T n)
 
template<class T >
void endiansame (T *buf, size_t len)
 
template<class T >
lilswap (T n)
 
template<class T >
void lilswap (T *buf, size_t len)
 
template<class T >
bigswap (T n)
 
template<class T >
void bigswap (T *buf, size_t len)
 

Variables

const int islittleendian = 1
 Legacy manual byte order swapping for serialisation. More...
 

Function Documentation

template<class T >
T bigswap ( n)
inline

References endianswap(), and islittleendian.

Referenced by stream::getbig(), and stream::putbig().

template<class T >
void bigswap ( T *  buf,
size_t  len 
)
inline

References endianswap(), and islittleendian.

template<class T >
T endiansame ( n)
inline
template<class T >
void endiansame ( T *  buf,
size_t  len 
)
inline
template<class T >
T endianswap ( n)
inline
template<class T >
void endianswap ( T *  buf,
size_t  len 
)
inline

References gle::end(), and endianswap().

ushort endianswap16 ( ushort  n)
inline
uint endianswap32 ( uint  n)
inline
ullong endianswap64 ( ullong  n)
inline
template<>
double endianswap< double > ( double  n)
inline
template<>
int endianswap< int > ( int  n)
inline

References endianswap32().

template<>
llong endianswap< llong > ( llong  n)
inline

References endianswap64().

template<>
short endianswap< short > ( short  n)
inline

References endianswap16().

template<>
uint endianswap< uint > ( uint  n)
inline

References endianswap32().

template<>
ullong endianswap< ullong > ( ullong  n)
inline

References endianswap64().

template<>
ushort endianswap< ushort > ( ushort  n)
inline

References endianswap16().

template<class T >
T lilswap ( n)
inline
template<class T >
void lilswap ( T *  buf,
size_t  len 
)
inline

References endianswap(), and islittleendian.

Variable Documentation

const int islittleendian = 1

Legacy manual byte order swapping for serialisation.

Define mainly two macros: lilswap and bigswap

Avoid this: use libraries which abstract endianess away for saved/transmitted data.

Referenced by bigswap(), tiger::gensboxes(), tiger::hash(), and lilswap().