Go to the documentation of this file.
7 #if defined (__HAIKU__) //For unknow reasons, Haiku don't fit into any case below
9 #elif defined (__APPLE__) || defined (MACOSX) || defined (BSD) || defined (__FreeBSD__)
10 #include <machine/endian.h>
14 # include <sys/endian.h>
16 #elif !defined (_WIN32) && !defined (__CYGWIN__) && !defined (SOLARIS)
19 # define __BIG_ENDIAN 1
20 # define __LITTLE_ENDIAN 0
21 # define __BYTE_ORDER 0
24 #if defined (__APPLE__) || defined (MACOSX)
25 #include <machine/endian.h>
26 #if __BYTE_ORDER == __BIG_ENDIAN
27 # include <machine/byte_order.h>
28 # define le32_to_cpu( x ) ( NXSwapHostLongToLittle( x ) )
29 # define le16_to_cpu( x ) ( NXSwapHostShortToLittle( x ) )
30 # define le64_to_cpu( x ) ( DONTUSE__NXSwapBigDoubleToLittleEndian( x ) )
32 # define le32_to_cpu( x ) (x)
33 # define le16_to_cpu( x ) (x)
34 # define le64_to_cpu( x ) (x)
37 #if defined (IRIX) || (defined (__SVR4) && defined (__sun ) )
38 #include <sys/types.h>
39 # if BYTE_ORDER == BIG_ENDIAN
40 # define le32_to_cpu( x ) \
42 |( ( (x)<<8 )&0x00FF0000 ) \
43 |( ( (uint32_t) (x)>>8 )&0x0000FF00 ) \
44 |( (uint32_t) (x)>>24 ) )
45 # define le16_to_cpu( x ) ( ( (x&0xFF)<<8 )|( (unsigned short) (x)>>8 ) )
46 # define le64_to_cpu( x ) ( DONTUSE__NXSwapBigDoubleToLittleEndian( x ) )
48 # define le32_to_cpu( x ) (x)
49 # define le16_to_cpu( x ) (x)
50 # define le64_to_cpu( x ) (x)
53 #elif __BYTE_ORDER == __BIG_ENDIAN && !defined (BSD) && !defined (__FreeBSD__)
54 # include <byteswap.h>
55 # define le32_to_cpu( x ) ( bswap_32( x ) )
56 # define le16_to_cpu( x ) ( bswap_16( x ) )
57 # define le64_to_cpu( x ) ( DONTUSE__NXSwapBigDoubleToLittleEndian( x ) )
59 # define le32_to_cpu( x ) (x)
60 # define le16_to_cpu( x ) (x)
61 # define le64_to_cpu( x ) (x)
108 #endif //_ENDIANNESS_H