From e53d23a9255f8aa6beb1b238f25f3ca1448d3286 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 13 Apr 1988 13:05:38 +0000 Subject: [PATCH] some minor improvements --- modules/src/idf/idf_pkg.body | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/src/idf/idf_pkg.body b/modules/src/idf/idf_pkg.body index 062e28ce1..8869a68d4 100644 --- a/modules/src/idf/idf_pkg.body +++ b/modules/src/idf/idf_pkg.body @@ -10,7 +10,7 @@ #define HASHSIZE 256 /* size of hashtable, must be a power of 2 */ #ifndef IDF_HSIZE -#define IDF_HSIZE 64 /* # of significant characters for hashing. +#define IDF_HSIZE 16 /* # of significant characters for hashing. This is NOT the number of significant characters! */ @@ -20,9 +20,9 @@ #define HASH_C 153 /* Knuth's c */ #define HASHMASK (HASHSIZE-1) /* since it is a power of 2 */ -#define STARTHASH() (0) -#define ENHASH(hs,ch,hm) (hs + (ch ^ hm)) -#define STOPHASH(hs) (hs & HASHMASK) +#define STARTHASH(hs) (hs = 0) +#define ENHASH(hs,ch,hm) (hs += (ch ^ hm)) +#define STOPHASH(hs) (hs &= HASHMASK) static char hmask[IDF_HSIZE]; @@ -106,11 +106,11 @@ str2idf(tg, cpy) register int hash; int size; - hash = STARTHASH(); + STARTHASH(hash); while (*cp && phm < &hmask[IDF_HSIZE]) { - hash = ENHASH(hash, *cp++, *phm++); + ENHASH(hash, *cp++, *phm++); } - hash = STOPHASH(hash); + STOPHASH(hash); while (*cp++) /* nothing. Find end of string */ ; size = cp - tg;