Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

snxEndian Namespace Reference


Enumerations

enum  Endianness { BIG, LITTLE }

Functions

template<class Type> void byteReverse (Type &bytes)
template<class Type> void byteReverse (Endianness &e, Type &bytes)


Enumeration Type Documentation

enum snxEndian::Endianness
 

Enumeration values:
BIG 
LITTLE 

Definition at line 75 of file Endian.h.

00076    {
00077       BIG, LITTLE
00078    };   


Function Documentation

template<class Type>
void byteReverse Type &    bytes [inline]
 

Definition at line 57 of file Endian.h.

00058    {     
00059       const int size = sizeof(Type);
00060       Type buf = 0;
00061       int x, y;
00062 
00063       //we want to index the bytes in the buffer
00064       unsigned char* buffer = (unsigned char*) &buf;
00065 
00066       for ( x = 0, y = size-1; 
00067          x < size;
00068          ++x, --y )
00069       {
00070          buffer[x] |= ((unsigned char*)&bytes)[y];
00071       }
00072       bytes = buf;
00073    }

template<class Type>
void byteReverse Endianness   e,
Type &    bytes
[inline]
 

Definition at line 81 of file Endian.h.

00082    {
00083       if (e == BIG && vpr::System::isLittleEndian())
00084       {
00085          byteReverse( bytes );
00086       }
00087       if (e == LITTLE && vpr::System::isBigEndian())
00088       {
00089          byteReverse( bytes );
00090       }
00091    }


Generated on Sun May 2 14:39:34 2004 for Juggler Sonix by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002