From: Rusty Russell Date: Sat, 2 Apr 2011 01:36:49 +0000 (+1030) Subject: hash: use config.h settings for endian. X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=97648992fdd50535fe276261368c179df993202b hash: use config.h settings for endian. Leave old hacky #ifdef tests there for reference. --- diff --git a/ccan/hash/hash.c b/ccan/hash/hash.c index a9948821..4fe5cfe6 100644 --- a/ccan/hash/hash.c +++ b/ccan/hash/hash.c @@ -40,9 +40,7 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #include /* defines time_t for timings in the test */ #include /* defines uint32_t etc */ #include /* attempt to define endianness */ -#endif -#include "hash.h" #ifdef linux # include /* attempt to define endianness */ #endif @@ -66,6 +64,19 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. #else # error Unknown endian #endif +#endif /* old hash.c headers. */ + +#include "hash.h" + +#if HAVE_LITTLE_ENDIAN +#define HASH_LITTLE_ENDIAN 1 +#define HASH_BIG_ENDIAN 0 +#elif HAVE_BIG_ENDIAN +#define HASH_LITTLE_ENDIAN 0 +#define HASH_BIG_ENDIAN 1 +#else +#error Unknown endian +#endif #define hashsize(n) ((uint32_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) diff --git a/ccan/hash/hash.h b/ccan/hash/hash.h index 3db75753..0400e6a3 100644 --- a/ccan/hash/hash.h +++ b/ccan/hash/hash.h @@ -1,8 +1,8 @@ #ifndef CCAN_HASH_H #define CCAN_HASH_H +#include "config.h" #include #include -#include "config.h" #include /* Stolen mostly from: lookup3.c, by Bob Jenkins, May 2006, Public Domain.