]> git.ozlabs.org Git - ccan/blobdiff - ccan/hash/hash.c
tdb2: implement tdb_chainlock_read/tdb_chainunlock_read.
[ccan] / ccan / hash / hash.c
index 9b3f58b2b20a649785b7f053c4c7828413610148..4fe5cfe67c3f27c196964d5e00796ba80db49c67 100644 (file)
@@ -40,9 +40,7 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
 #include <time.h>       /* defines time_t for timings in the test */
 #include <stdint.h>     /* defines uint32_t etc */
 #include <sys/param.h>  /* attempt to define endianness */
-#endif
 
-#include "hash.h"
 #ifdef linux
 # include <endian.h>    /* attempt to define endianness */
 #endif
@@ -54,7 +52,8 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
 #if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \
      __BYTE_ORDER == __LITTLE_ENDIAN) || \
     (defined(i386) || defined(__i386__) || defined(__i486__) || \
-     defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL))
+     defined(__i586__) || defined(__i686__) || defined(__x86_64) || \
+     defined(vax) || defined(MIPSEL))
 # define HASH_LITTLE_ENDIAN 1
 # define HASH_BIG_ENDIAN 0
 #elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \
@@ -65,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)
@@ -741,7 +753,7 @@ void driver2()
     {
       for (j=0; j<8; ++j)   /*------------------------ for each input bit, */
       {
-       for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
+       for (m=1; m<8; ++m) /*------------ for several possible initvals, */
        {
          for (l=0; l<HASHSTATE; ++l)
            e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32_t)0);