Enumerations | |
| enum | Endianness { BIG, LITTLE } |
Functions | |
| template<class Type> void | byteReverse (Type &bytes) |
| template<class Type> void | byteReverse (Endianness &e, Type &bytes) |
|
|
Definition at line 75 of file Endian.h.
|
|
||||||||||
|
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 }
|
|
||||||||||||||||
|
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 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002