From 20c4839edb394def43c07646d87d0cdbabefffa6 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 18 Jul 2012 01:56:52 +0000 Subject: performance improvement: new hash function git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1719 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- doc/HISTORY | 3 +++ lib/libpammap.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/HISTORY b/doc/HISTORY index 57fca970..b9d39af0 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -6,6 +6,9 @@ CHANGE HISTORY not yet BJH Release 10.60.00 + pnm_hashtuple: slight performance improvement from new hash + function. Thanks Prophet of the Way . + ppmtospu: wild memory accesses. Always broken (program added in 10.58 (March 2012). diff --git a/lib/libpammap.c b/lib/libpammap.c index 8477875a..fe6cba2d 100644 --- a/lib/libpammap.c +++ b/lib/libpammap.c @@ -31,9 +31,10 @@ pnm_hashtuple(struct pam * const pamP, Return the hash value of the tuple 'tuple' -- i.e. an index into a hash table. -----------------------------------------------------------------------------*/ + unsigned int const hash_factor[] = {1, 33, 33*33}; + unsigned int i; unsigned int hash; - const unsigned int hash_factor[] = {33*33, 33, 1}; hash = 0; /* initial value */ for (i = 0; i < MIN(pamP->depth, 3); ++i) { -- cgit 1.4.1