Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Endian.h

Go to the documentation of this file.
00001 #ifndef Impala_Basis_Endian_h
00002 #define Impala_Basis_Endian_h
00003 
00004 #include <algorithm>
00005 #include "Basis/NativeTypes.h"
00006 
00007 namespace Impala
00008 {
00009 
00010 inline void
00011 EndianSwapIt(UInt8* b, int n)
00012 {
00013     int i = 0;
00014     int j = n-1;
00015     while (i<j)
00016     {
00017         std::swap(b[i], b[j]);
00018         i++;
00019         j--;
00020     }
00021 }
00022 
00023 template <class Type>
00024 inline void
00025 EndianSwap(Type* v)
00026 {
00027 #ifdef BIG_ENDIAN_IO
00028     EndianSwapIt((UInt8 *) v, sizeof(Type));
00029 #endif
00030 }
00031 
00032 } // namespace Impala
00033 
00034 #endif

Generated on Fri Mar 19 09:30:41 2010 for ImpalaSrc by  doxygen 1.5.1