about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-08-22 19:32:33 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-08-22 19:32:33 +0000
commiteaefcd776d24134c5741bc908919988529ab74f7 (patch)
tree75d98247695137166d7eec706971d0fdc1e8546d /lib
parentf187d36ed6d15d8826323fd8ab884bdfb8cbcfd8 (diff)
downloadnetpbm-mirror-eaefcd776d24134c5741bc908919988529ab74f7.tar.gz
netpbm-mirror-eaefcd776d24134c5741bc908919988529ab74f7.tar.xz
netpbm-mirror-eaefcd776d24134c5741bc908919988529ab74f7.zip
New ash function
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1553 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib')
-rw-r--r--lib/libppmcmap.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/libppmcmap.c b/lib/libppmcmap.c
index 1fd87441..1f7e459d 100644
--- a/lib/libppmcmap.c
+++ b/lib/libppmcmap.c
@@ -20,10 +20,17 @@
 
 #define HASH_SIZE 20023
 
-#define ppm_hashpixel(p) ( ( ( (long) PPM_GETR(p) * 33023 + \
-                               (long) PPM_GETG(p) * 30013 + \
-                               (long) PPM_GETB(p) * 27011 ) \
-                             & 0x7fffffff ) % HASH_SIZE )
+
+
+static __inline__ unsigned int
+ppm_hashpixel(pixel const p) {
+
+    return (unsigned int) (PPM_GETR(p) * 33 * 33
+                           + PPM_GETG(p) * 33
+                           + PPM_GETB(p)) % HASH_SIZE;
+}
+
+
 
 colorhist_vector
 ppm_computecolorhist( pixel ** const pixels,