aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorPaul Eggert2013-02-09 14:42:33 -0800
committerPaul Eggert2013-02-09 14:42:33 -0800
commiteff1c1900f47ec5dfb6d435325b366362d09d2db (patch)
tree9db491fe10a82b95f493b8ae6cdfc3d56103b2fa /src/fns.c
parent4dde2087c47f0ef2a97c3b39d89b94b8a47baf37 (diff)
downloademacs-eff1c1900f47ec5dfb6d435325b366362d09d2db.tar.gz
emacs-eff1c1900f47ec5dfb6d435325b366362d09d2db.zip
Minor hashing refactoring.
* fns.c (SXHASH_REDUCE): Move to lisp.h. (sxhash_float): Return EMACS_UINT, for consistency with the other hash functions. * lisp.h (INTMASK): Now a macro, since SXHASH_REDUCE is now a non-static inline function and therefore can't use static vars. (SXHASH_REDUCE): Move here from fns.c, and make it inline. * profiler.c (hashfn_profiler): Use SXHASH_REDUCE, to be consistent with the other hash functions.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/fns.c b/src/fns.c
index ecd1a31335a..527976593da 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4045,10 +4045,6 @@ sweep_weak_hash_tables (void)
4045 4045
4046#define SXHASH_MAX_LEN 7 4046#define SXHASH_MAX_LEN 7
4047 4047
4048/* Hash X, returning a value that fits into a Lisp integer. */
4049#define SXHASH_REDUCE(X) \
4050 ((((X) ^ (X) >> (BITS_PER_EMACS_INT - FIXNUM_BITS))) & INTMASK)
4051
4052/* Return a hash for string PTR which has length LEN. The hash value 4048/* Return a hash for string PTR which has length LEN. The hash value
4053 can be any EMACS_UINT value. */ 4049 can be any EMACS_UINT value. */
4054 4050
@@ -4081,7 +4077,7 @@ sxhash_string (char const *ptr, ptrdiff_t len)
4081 4077
4082/* Return a hash for the floating point value VAL. */ 4078/* Return a hash for the floating point value VAL. */
4083 4079
4084static EMACS_INT 4080static EMACS_UINT
4085sxhash_float (double val) 4081sxhash_float (double val)
4086{ 4082{
4087 EMACS_UINT hash = 0; 4083 EMACS_UINT hash = 0;