apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Reid" <dr...@jetnet.co.uk>
Subject Hash?
Date Tue, 02 Jan 2001 01:55:46 GMT
This was suggested by Carlos Hasan mailto:chasan@acm.org but as I'm not
overly familiar with the hashing code I'm putting it forward rather than
committing it :)

david

Index: tables/apr_hash.c
===================================================================
RCS file: /home/cvs/apr/tables/apr_hash.c,v
retrieving revision 1.9
diff -u -r1.9 apr_hash.c
--- tables/apr_hash.c   2000/11/08 00:54:23     1.9
+++ tables/apr_hash.c   2001/01/02 01:30:14
@@ -255,8 +255,9 @@
      */
     hash = 0;
     for (p = key, i = klen; i; i--, p++)
-       hash = hash * 33 + *p;
+        hash += (hash << 5) + *p;
+
     /* scan linked list */
     for (hep = &ht->array[hash & ht->max], he = *hep;
         he;




Mime
View raw message