diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-07-07 17:51:25 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-07-07 17:51:25 -0700 |
commit | 3cc5a5328c43317b12a7163c4e1c0a56d85b93ce (patch) | |
tree | 880e8f775ca3d34e357f1fda7ab2df57acd744aa /src/lread.c | |
parent | b312a4929d4ed7bc900a54f506905801f860ce7c (diff) | |
download | emacs-3cc5a5328c43317b12a7163c4e1c0a56d85b93ce.tar.gz |
Improve hashing quality when configured --with-wide-int.
* fns.c (hash_string): New function, taken from sxhash_string.
Do not discard information about ASCII character case; this
discarding is no longer needed.
(sxhash-string): Use it. Change sig to match it. Caller changed.
* lisp.h: Declare it.
* lread.c (hash_string): Remove, since we now use fns.c's version.
The fns.c version returns a wider integer if --with-wide-int is
specified, so this should help the quality of the hashing a bit.
Diffstat (limited to 'src/lread.c')
-rw-r--r-- | src/lread.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/src/lread.c b/src/lread.c index a9b69a1977b..6a97be2be42 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3647,8 +3647,6 @@ static Lisp_Object initial_obarray; static size_t oblookup_last_bucket_number; -static size_t hash_string (const char *ptr, size_t len); - /* Get an error if OBARRAY is not an obarray. If it is one, return it. */ @@ -3891,23 +3889,6 @@ oblookup (Lisp_Object obarray, register const char *ptr, EMACS_INT size, EMACS_I XSETINT (tem, hash); return tem; } - -static size_t -hash_string (const char *ptr, size_t len) -{ - register const char *p = ptr; - register const char *end = p + len; - register unsigned char c; - register size_t hash = 0; - - while (p != end) - { - c = *p++; - if (c >= 0140) c -= 40; - hash = (hash << 3) + (hash >> (CHAR_BIT * sizeof hash - 4)) + c; - } - return hash; -} void map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg) |