diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2013-02-18 21:57:40 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2013-02-18 21:57:40 +0000 |
commit | f628085a23e23a4dddff6dc9ac7a401b586fa258 (patch) | |
tree | 518ed6dfaca8305e7a432ae97e7d03b4eec43b29 | |
parent | fee99dfec35306ec042b0e691eebc54e9a2ba1b9 (diff) |
Fix determination of endianness with *BSD OS's.
ok sthen@
-rw-r--r-- | usr.sbin/nsd/lookup3.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.sbin/nsd/lookup3.c b/usr.sbin/nsd/lookup3.c index 6fedd4d69d1..a42cbf9f807 100644 --- a/usr.sbin/nsd/lookup3.c +++ b/usr.sbin/nsd/lookup3.c @@ -52,6 +52,12 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #ifdef linux # include <endian.h> /* attempt to define endianness */ #endif +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) +#include <sys/endian.h> /* attempt to define endianness */ +#endif +#ifdef __OpenBSD__ +#include <machine/endian.h> /* attempt to define endianness */ +#endif /* random initial value */ static uint32_t raninit = 0xdeadbeef; @@ -68,12 +74,16 @@ hash_set_raninit(uint32_t v) */ #if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ __BYTE_ORDER == __LITTLE_ENDIAN) || \ + (defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN) && \ + _BYTE_ORDER == _LITTLE_ENDIAN) || \ (defined(i386) || defined(__i386__) || defined(__i486__) || \ defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL)) # define HASH_LITTLE_ENDIAN 1 # define HASH_BIG_ENDIAN 0 #elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ __BYTE_ORDER == __BIG_ENDIAN) || \ + (defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && \ + _BYTE_ORDER == _BIG_ENDIAN) || \ (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel)) # define HASH_LITTLE_ENDIAN 0 # define HASH_BIG_ENDIAN 1 |