OSSP CVS Repository

ossp - Difference in ossp-pkg/act/act_hash_fct.c versions 1.20 and 1.21
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/act/act_hash_fct.c 1.20 -> 1.21

--- act_hash_fct.c       2000/08/18 15:58:09     1.20
+++ act_hash_fct.c       2000/08/18 19:36:10     1.21
@@ -83,6 +83,7 @@
 ** | DJBX33X      1.23      0      0      0 86.80    0    8    8   -2.24    0.38 |
 ** | JEDI         1.30      0      0      0 86.80    0    8    8    0.13   -0.70 |
 ** | VOCONG       1.41      0      0      0 85.90    0    9    9   -0.92    0.44 |
+** | CDT          1.93      0      0      0 88.50    0    7    7    0.35   -2.18 |
 ** | JOTCL        1.69      0      0      0 85.80    0    7    7   -2.12    0.16 |
 ** | BJDDJ        2.34      0      0      0 85.30    0    8    8    1.90    1.23 |
 ** | CRC32        2.95      0      0      0 86.80    0    8    8    0.85   -0.89 |
@@ -295,6 +296,25 @@
 }
 
 /*
+ * CDT (Container Data Type, Congruential Hash)
+ *
+ * This is the linear congruential hash ``h * 17 + c + 97531'' as used
+ * in the AT&T's Cdt library. It is very fast and distributes very well.
+ * For details see Cdt's cdt.h file.
+ */
+intern act_uint32_t 
+act_hash_fct_cdt(
+    register act_uint8_t *key, 
+    register act_size_t len)
+{
+    register act_uint32_t hash = 0;
+
+    while (len-- > 0)
+        hash = (hash << 4) + hash + *key++ + 97531;
+    return hash;
+}
+
+/*
  * JOTCL (John Ousterhout, Tcl)
  *
  * This is John Ousterhout's hash from his Tcl 8.2's tclHash.c. He
@@ -1065,6 +1085,7 @@
     { "DJBX33X",  act_hash_fct_djbx33x,  EMPTY_STAT },
     { "JEDI",     act_hash_fct_jedi,     EMPTY_STAT },
     { "VOCONG",   act_hash_fct_vocong,   EMPTY_STAT },
+    { "CDT",      act_hash_fct_cdt,      EMPTY_STAT },
     { "JOTCL",    act_hash_fct_jotcl,    EMPTY_STAT },
     { "BJDDJ",    act_hash_fct_bjddj,    EMPTY_STAT },
     { "CRC32",    act_hash_fct_crc32,    EMPTY_STAT },

CVSTrac 2.0.1