Mercurial > hg > xemacs-beta
diff src/symbols.c @ 100:4be1180a9e89 r20-1b2
Import from CVS: tag r20-1b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:15:11 +0200 |
parents | 6a378aca36af |
children | 85ec50267440 |
line wrap: on
line diff
--- a/src/symbols.c Mon Aug 13 09:13:58 2007 +0200 +++ b/src/symbols.c Mon Aug 13 09:15:11 2007 +0200 @@ -328,6 +328,7 @@ return (make_int (hash)); } +#if 0 /* Emacs 19.34 */ int hash_string (CONST Bufbyte *ptr, Bytecount len) { @@ -344,6 +345,26 @@ } return hash & 07777777777; } +#endif + +/* derived from hashpjw, Dragon Book P436. */ +int +hash_string (CONST Bufbyte *ptr, Bytecount len) +{ + CONST Bufbyte *p = ptr; + int hash = 0, g; + Bytecount count = len; + + while (count-- > 0) + { + hash = (hash << 4) + *p++; + if (g = (hash & 0xf0000000)) { + hash = hash ^ (g >> 24); + hash = hash ^ g; + } + } + return hash & 07777777777; +} void map_obarray (Lisp_Object obarray,