about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-07-18 01:56:52 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-07-18 01:56:52 +0000
commit20c4839edb394def43c07646d87d0cdbabefffa6 (patch)
tree1520e68a422dd8cbb0ddb6af06649e52d5eff8fe
parentbcb9e4803365f4a670bcb73d48efed51c488006b (diff)
downloadnetpbm-mirror-20c4839edb394def43c07646d87d0cdbabefffa6.tar.gz
netpbm-mirror-20c4839edb394def43c07646d87d0cdbabefffa6.tar.xz
netpbm-mirror-20c4839edb394def43c07646d87d0cdbabefffa6.zip
performance improvement: new hash function
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1719 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY3
-rw-r--r--lib/libpammap.c3
2 files changed, 5 insertions, 1 deletions
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 <afu@wta.att.ne.jp>.
+
               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) {