diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2011-08-23 17:51:24 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2011-08-23 17:51:24 +0000 |
commit | 1a100f7692ea04986b5151987edd1d6f06803fdb (patch) | |
tree | 0058f228d7648b13a26f906cd57e325ad6ec12b9 | |
parent | 51251cc297715437c2f3be0b4b499be54919fa21 (diff) | |
download | netpbm-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.c | 4 |
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; |