freebsd-dev/contrib/lib9p/apple_endian.h
Jakub Wojciech Klama 134e17798c Import lib9p 7ddb1164407da19b9b1afb83df83ae65a71a9a66.
Approved by:	trasz
MFC after:	1 month
Sponsored by:	Conclusive Engineering (development), vStack.com (funding)
2020-05-14 19:57:52 +00:00

28 lines
613 B
C

#ifndef _APPLE_ENDIAN_H
#define _APPLE_ENDIAN_H
/*
* Shims to make Apple's endian headers and macros compatible
* with <sys/endian.h> (which is awful).
*/
# include <libkern/OSByteOrder.h>
# define _LITTLE_ENDIAN 0x12345678
# define _BIG_ENDIAN 0x87654321
# ifdef __LITTLE_ENDIAN__
# define _BYTE_ORDER _LITTLE_ENDIAN
# endif
# ifdef __BIG_ENDIAN__
# define _BYTE_ORDER _BIG_ENDIAN
# endif
# define htole32(x) OSSwapHostToLittleInt32(x)
# define le32toh(x) OSSwapLittleToHostInt32(x)
# define htobe32(x) OSSwapHostToBigInt32(x)
# define be32toh(x) OSSwapBigToHostInt32(x)
#endif /* _APPLE_ENDIAN_H */