diff --git a/lib/isc/symtab.c b/lib/isc/symtab.c index c218a36b4c..948a86fa60 100644 --- a/lib/isc/symtab.c +++ b/lib/isc/symtab.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: symtab.c,v 1.22 2001/01/09 21:56:31 bwelling Exp $ */ +/* $Id: symtab.c,v 1.23 2001/03/07 23:52:16 gson Exp $ */ #include @@ -120,32 +120,22 @@ static inline unsigned int hash(const char *key, isc_boolean_t case_sensitive) { const char *s; unsigned int h = 0; - unsigned int g; int c; /* - * P. J. Weinberger's hash function, adapted from p. 436 of - * _Compilers: Principles, Techniques, and Tools_, Aho, Sethi - * and Ullman, Addison-Wesley, 1986, ISBN 0-201-10088-6. + * This hash function is similar to the one Ousterhout + * uses in Tcl. */ if (case_sensitive) { for (s = key; *s != '\0'; s++) { - h = ( h << 4 ) + *s; - if ((g = ( h & 0xf0000000 )) != 0) { - h = h ^ (g >> 24); - h = h ^ g; - } + h += (h << 3) + *s; } } else { for (s = key; *s != '\0'; s++) { c = *s; c = tolower((unsigned char)c); - h = ( h << 4 ) + c; - if ((g = ( h & 0xf0000000 )) != 0) { - h = h ^ (g >> 24); - h = h ^ g; - } + h += (h << 3) + c; } }