From eaefcd776d24134c5741bc908919988529ab74f7 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Mon, 22 Aug 2011 19:32:33 +0000 Subject: New ash function git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1553 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/libppmcmap.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/libppmcmap.c') 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, -- cgit 1.4.1