28 #include "boost/static_assert.hpp"
35 #if defined(__GLIBC__) || defined(__GLIBCXX__)
45 #if (defined(PWIZ_GCC) && defined(__BYTE_ORDER) && __BYTE_ORDER==__LITTLE_ENDIAN) || \
46 (defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER==__DARWIN_LITTLE_ENDIAN) || \
47 (defined(__LITTLE_ENDIAN__)) || \
48 (defined(__MINGW32__)) || \
49 (defined(__i386__)) || \
51 #define PWIZ_LITTLE_ENDIAN
55 #if (defined(PWIZ_GCC) && defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN)
56 #define PWIZ_BIG_ENDIAN
60 #if defined(PWIZ_LITTLE_ENDIAN) && defined(PWIZ_BIG_ENDIAN)
61 #error "This isn't happening."
65 #if !defined(PWIZ_LITTLE_ENDIAN) && !defined(PWIZ_BIG_ENDIAN)
66 #error "Unsupported platform: probably need a platform-specific define above."
76 return ((n&0xff)<<24) | ((n&0xff00)<<8) | ((n&0xff0000)>>8) | ((n&0xff000000)>>24);
82 return ((n&0x00000000000000ffll)<<56) |
83 ((n&0x000000000000ff00ll)<<40) |
84 ((n&0x0000000000ff0000ll)<<24) |
85 ((n&0x00000000ff000000ll)<<8) |
86 ((n&0x000000ff00000000ll)>>8) |
87 ((n&0x0000ff0000000000ll)>>24) |
88 ((n&0x00ff000000000000ll)>>40) |
89 ((n&0xff00000000000000ll)>>56);
107 #endif // _ENDIAN_HPP_