]> git.ozlabs.org Git - ccan/blobdiff - ccan/hash/hash.c
hash: switch to CC0 license.
[ccan] / ccan / hash / hash.c
index 4fe5cfe67c3f27c196964d5e00796ba80db49c67..5ccc695505e76929cffccc7a4f5dbbde44e7f72d 100644 (file)
@@ -1,3 +1,4 @@
+/* CC0 (Public domain) - see LICENSE file for details */
 /*
 -------------------------------------------------------------------------------
 lookup3.c, by Bob Jenkins, May 2006, Public Domain.
 /*
 -------------------------------------------------------------------------------
 lookup3.c, by Bob Jenkins, May 2006, Public Domain.
@@ -259,9 +260,7 @@ static uint32_t hashlittle( const void *key, size_t length, uint32_t *val2 )
   u.ptr = key;
   if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
     const uint32_t *k = (const uint32_t *)key;         /* read 32-bit chunks */
   u.ptr = key;
   if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
     const uint32_t *k = (const uint32_t *)key;         /* read 32-bit chunks */
-#ifdef VALGRIND
     const uint8_t  *k8;
     const uint8_t  *k8;
-#endif
 
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
     while (length > 12)
 
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
     while (length > 12)
@@ -283,9 +282,10 @@ static uint32_t hashlittle( const void *key, size_t length, uint32_t *val2 )
      * does it on word boundaries, so is OK with this.  But VALGRIND will
      * still catch it and complain.  The masking trick does make the hash
      * noticably faster for short strings (like English words).
      * does it on word boundaries, so is OK with this.  But VALGRIND will
      * still catch it and complain.  The masking trick does make the hash
      * noticably faster for short strings (like English words).
+     *
+     * Not on my testing with gcc 4.5 on an intel i5 CPU, at least --RR.
      */
      */
-#ifndef VALGRIND
-
+#if 0
     switch(length)
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
     switch(length)
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
@@ -437,9 +437,7 @@ static uint32_t hashbig( const void *key, size_t length, uint32_t *val2)
   u.ptr = key;
   if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) {
     const uint32_t *k = (const uint32_t *)key;         /* read 32-bit chunks */
   u.ptr = key;
   if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) {
     const uint32_t *k = (const uint32_t *)key;         /* read 32-bit chunks */
-#ifdef VALGRIND
     const uint8_t  *k8;
     const uint8_t  *k8;
-#endif
 
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
     while (length > 12)
 
     /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
     while (length > 12)
@@ -461,9 +459,10 @@ static uint32_t hashbig( const void *key, size_t length, uint32_t *val2)
      * does it on word boundaries, so is OK with this.  But VALGRIND will
      * still catch it and complain.  The masking trick does make the hash
      * noticably faster for short strings (like English words).
      * does it on word boundaries, so is OK with this.  But VALGRIND will
      * still catch it and complain.  The masking trick does make the hash
      * noticably faster for short strings (like English words).
+     *
+     * Not on my testing with gcc 4.5 on an intel i5 CPU, at least --RR.
      */
      */
-#ifndef VALGRIND
-
+#if 0
     switch(length)
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
     switch(length)
     {
     case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;