New macro _hash_eq
authorJuan Jose Garcia Ripoll <jjgarcia@jjgr-2.local>
Wed, 20 Jan 2010 21:55:53 +0000 (22:55 +0100)
committerJuan Jose Garcia Ripoll <jjgarcia@jjgr-2.local>
Wed, 20 Jan 2010 21:55:53 +0000 (22:55 +0100)
src/c/hash.d

index 6be6775..edcc729 100644 (file)
@@ -276,6 +276,12 @@ _hash_equalp(int depth, cl_hashkey h, cl_object x)
  * EQ HASHTABLES
  */
 
+#if 0
+#define _hash_eq(k) ((cl_hashkey)(k) ^ ((cl_hashkey)(k) >> 16))
+#else
+#define _hash_eq(k) ((cl_hashkey)(k) >> 2)
+#endif
+
 static struct ecl_hashtable_entry *
 _ecl_hash_loop_eq(cl_hashkey h, cl_object key, cl_object hashtable)
 {
@@ -285,14 +291,14 @@ _ecl_hash_loop_eq(cl_hashkey h, cl_object key, cl_object hashtable)
 struct ecl_hashtable_entry *
 _ecl_gethash_eq(cl_object key, cl_object hashtable)
 {
-       cl_hashkey h = (cl_hashkey)key >> 2;
+       cl_hashkey h = _hash_eq(key);
        return _ecl_hash_loop_eq(h, key, hashtable);
 }
 
 cl_object
 _ecl_sethash_eq(cl_object key, cl_object hashtable, cl_object value)
 {
-       HASH_TABLE_SET(h, _ecl_hash_loop_eq, (cl_hashkey)key >> 2, key);
+       HASH_TABLE_SET(h, _ecl_hash_loop_eq, _hash_eq(key), key);
 }
 
 /*