]> mj.ucw.cz Git - libucw.git/blobdiff - lib/hashfunc.c
Empty final bucket should be turned into a file as well.
[libucw.git] / lib / hashfunc.c
index 2f951c6977ab5725e49281fa5135bfcb4d9d4592..f51c84e8ec42b67f190a0a95c630e1ad7cfbdf4b 100644 (file)
@@ -1,11 +1,14 @@
 /*
- *     Hyper-super-meta-alt-control-shift extra fast str_len() and hash_*()
- *     routines
+ *     UCW Library -- Hyper-super-meta-alt-control-shift extra fast
+ *     str_len() and hash_*() routines
  *
  *     It is always at least as fast as the classical strlen() routine and for
  *     strings longer than 100 characters, it is substantially faster.
  *
  *     (c) 2002, Robert Spalek <robert@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
  */
 
 #include "lib/lib.h"
@@ -14,7 +17,7 @@
 
 /* The number of bits the hash in the function hash_*() is rotated by after
  * every pass.  It should be prime with the word size.  */
-#define        SHIFT_BITS      5
+#define        SHIFT_BITS      7
 
 /* A bit-mask which clears higher bytes than a given threshold.  */
 static uns mask_higher_bits[sizeof(uns)];
@@ -42,7 +45,7 @@ str_len_uns(uns x)
        uns a, i;
        byte *bytes;
        a = ~x & (x - sub) & and;
-       /* 
+       /*
         * x_2 = x - 0x01010101;
         * x_3 = ~x & x_2;
         * a = x_3 & 0x80808080;