1 --- a/include/platform.h
2 +++ b/include/platform.h
5 # define __BIG_ENDIAN__ (BYTE_ORDER == BIG_ENDIAN)
6 # define __BYTE_ORDER BYTE_ORDER
7 -#elif defined __FreeBSD__
8 +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__) || defined(__APPLE__)
9 # include <sys/resource.h> /* rlimit */
10 # include <machine/endian.h>
11 # define bswap_64 __bswap64
12 # define bswap_32 __bswap32
13 # define bswap_16 __bswap16
14 # define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN)
15 -#elif !defined __APPLE__
17 # include <byteswap.h>
21 #elif defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
22 # define BB_BIG_ENDIAN 1
23 # define BB_LITTLE_ENDIAN 0
24 +#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN
25 +# define BB_BIG_ENDIAN 1
26 +# define BB_LITTLE_ENDIAN 0
27 #elif (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__386__)
28 # define BB_BIG_ENDIAN 0
29 # define BB_LITTLE_ENDIAN 1
30 +#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN
31 +# define BB_BIG_ENDIAN 0
32 +# define BB_LITTLE_ENDIAN 1
34 # error "Can't determine endianness"