Go to the documentation of this file.
36 #define IS_BIG_ENDIAN 4321
37 #define IS_LITTLE_ENDIAN 1234
40 #if defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ )
41 # include <sys/endian.h>
42 #elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
43 defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ )
44 # include <machine/endian.h>
45 #elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
46 # if !defined( __MINGW32__ ) && !defined(AVR)
48 # if !defined( __BEOS__ )
49 # include <byteswap.h>
58 #if defined( BIG_ENDIAN ) && defined( LITTLE_ENDIAN )
59 # if defined( BYTE_ORDER ) && BYTE_ORDER == BIG_ENDIAN
60 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
61 # elif defined( BYTE_ORDER ) && BYTE_ORDER == LITTLE_ENDIAN
62 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
64 #elif defined( BIG_ENDIAN )
65 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
66 #elif defined( LITTLE_ENDIAN )
67 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
70 #if defined( _BIG_ENDIAN ) && defined( _LITTLE_ENDIAN )
71 # if defined( _BYTE_ORDER ) && _BYTE_ORDER == _BIG_ENDIAN
72 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
73 # elif defined( _BYTE_ORDER ) && _BYTE_ORDER == _LITTLE_ENDIAN
74 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
76 #elif defined( _BIG_ENDIAN )
77 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
78 #elif defined( _LITTLE_ENDIAN )
79 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
82 #if defined( __BIG_ENDIAN ) && defined( __LITTLE_ENDIAN )
83 # if defined( __BYTE_ORDER ) && __BYTE_ORDER == __BIG_ENDIAN
84 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
85 # elif defined( __BYTE_ORDER ) && __BYTE_ORDER == __LITTLE_ENDIAN
86 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
88 #elif defined( __BIG_ENDIAN )
89 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
90 #elif defined( __LITTLE_ENDIAN )
91 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
94 #if defined( __BIG_ENDIAN__ ) && defined( __LITTLE_ENDIAN__ )
95 # if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__
96 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
97 # elif defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__
98 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
100 #elif defined( __BIG_ENDIAN__ )
101 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
102 #elif defined( __LITTLE_ENDIAN__ )
103 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
108 #if !defined(PLATFORM_BYTE_ORDER)
110 #if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \
111 defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \
112 defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \
113 defined( vax ) || defined( vms ) || defined( VMS ) || \
114 defined( __VMS ) || defined( _M_X64 ) || defined( AVR )
115 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
117 #elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \
118 defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \
119 defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \
120 defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \
121 defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \
122 defined( __VOS__ ) || defined( __TIGCC__ ) || defined( __TANDEM ) || \
123 defined( THINK_C ) || defined( __VMCMS__ )
124 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
127 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
129 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
131 # error Please edit lines 126 or 128 in brg_endian.h to set the platform byte order
137 #if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
138 # define PLATFORM_MUST_ALIGN (1)
139 #ifndef PLATFORM_BYTE_ORDER
140 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
144 #ifndef PLATFORM_MUST_ALIGN
145 # define PLATFORM_MUST_ALIGN (0)