1 #ifndef _APPLE_ENDIAN_H
2 #define _APPLE_ENDIAN_H
5 * Shims to make Apple's endian headers and macros compatible
6 * with <sys/endian.h> (which is awful).
9 # include <libkern/OSByteOrder.h>
11 # define _LITTLE_ENDIAN 0x12345678
12 # define _BIG_ENDIAN 0x87654321
14 # ifdef __LITTLE_ENDIAN__
15 # define _BYTE_ORDER _LITTLE_ENDIAN
17 # ifdef __BIG_ENDIAN__
18 # define _BYTE_ORDER _BIG_ENDIAN
21 # define htole32(x) OSSwapHostToLittleInt32(x)
22 # define le32toh(x) OSSwapLittleToHostInt32(x)
24 # define htobe32(x) OSSwapHostToBigInt32(x)
25 # define be32toh(x) OSSwapBigToHostInt32(x)
27 #endif /* _APPLE_ENDIAN_H */