Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef __LESWAPS_H
00008 #define __LESWAPS_H
00009
00010 #include "LETypes.h"
00011
00017 U_NAMESPACE_BEGIN
00018
00025 #define SWAPW(value) LESwaps::swapWord((le_uint16)(value))
00026
00033 #define SWAPL(value) LESwaps::swapLong((le_uint32)(value))
00034
00044 class U_LAYOUT_API LESwaps {
00045 public:
00046
00057 static le_uint16 swapWord(le_uint16 value)
00058 {
00059 return (le_uint16)((value << 8) | (value >> 8));
00060 };
00061
00072 static le_uint32 swapLong(le_uint32 value)
00073 {
00074 return (le_uint32)(
00075 (value << 24) |
00076 ((value << 8) & 0xff0000) |
00077 ((value >> 8) & 0xff00) |
00078 (value >> 24));
00079 };
00080
00081 private:
00082 LESwaps() {}
00083 };
00084
00085 U_NAMESPACE_END
00086 #endif