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