about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-08-23 17:51:24 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-08-23 17:51:24 +0000
commit1a100f7692ea04986b5151987edd1d6f06803fdb (patch)
tree0058f228d7648b13a26f906cd57e325ad6ec12b9
parent51251cc297715437c2f3be0b4b499be54919fa21 (diff)
downloadnetpbm-mirror-1a100f7692ea04986b5151987edd1d6f06803fdb.tar.gz
netpbm-mirror-1a100f7692ea04986b5151987edd1d6f06803fdb.tar.xz
netpbm-mirror-1a100f7692ea04986b5151987edd1d6f06803fdb.zip
new hash function
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1555 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--lib/libpammap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpammap.c b/lib/libpammap.c
index 663fe3c5..f73ec45e 100644
--- a/lib/libpammap.c
+++ b/lib/libpammap.c
@@ -33,11 +33,11 @@ pnm_hashtuple(struct pam * const pamP,
 -----------------------------------------------------------------------------*/
     unsigned int i;
     unsigned int hash;
-    const unsigned int hash_factor[] = {33023, 30013, 27011};
+    const unsigned int hash_factor[] = {33*33, 33, 1};
 
     hash = 0;  /* initial value */
     for (i = 0; i < MIN(pamP->depth, 3); ++i) {
-        hash += tuple[i] * hash_factor[i];  /* May overflow */
+        hash += tuple[i] * hash_factor[i];
     }
     hash %= HASH_SIZE;
     return hash;