]> sjero.net Git - wget/commitdiff
[svn] Name the source of the integer hash function.
authorhniksic <devnull@localhost>
Sat, 8 Nov 2003 03:42:58 +0000 (19:42 -0800)
committerhniksic <devnull@localhost>
Sat, 8 Nov 2003 03:42:58 +0000 (19:42 -0800)
src/hash.c

index 2c8d1351bb167bb4c9f5d1008b2c59210d89fa5a..49979c75a3fd801d6f6d947f0e42cf7e936d05cf 100644 (file)
@@ -175,9 +175,7 @@ struct hash_table {
   for (; NON_EMPTY (mp); mp = NEXT_MAPPING (mp, mappings, size))
 
 /* Return the position of KEY in hash table SIZE large, hash function
-   being HASHFUN.  #### Some implementations multiply HASHFUN's output
-   with the table's "golden ratio" to get better spreading of keys.
-   I'm not sure if that is necessary with our hash functions.  */
+   being HASHFUN.  */
 #define HASH_POSITION(key, hashfun, size) ((hashfun) (key) % size)
 
 /* Find a prime near, but greather than or equal to SIZE.  Of course,
@@ -639,9 +637,14 @@ make_nocase_string_hash_table (int items)
   return hash_table_new (items, string_hash_nocase, string_cmp_nocase);
 }
 
-/* Hashing of pointers.  Used for hash tables that are keyed by
-   pointer identity.  (Common Lisp calls them EQ hash tables, and Java
-   calls them IdentityHashMaps.)  */
+/* Hashing of numeric values, such as pointers and integers.  Used for
+   hash tables that are keyed by pointer identity.  (Common Lisp calls
+   them EQ hash tables, and Java calls them IdentityHashMaps.)
+
+   This implementation is the Robert Jenkins' 32 bit Mix Function,
+   with a simple adaptation for 64-bit values.  It offers excellent
+   spreading of values and doesn't need to know the hash table size to
+   work (unlike the very popular Knuth's multiplication hash).  */
 
 static unsigned long
 ptrhash (const void *ptr)