Changeset: 705818fe1329 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=705818fe1329
Modified Files:
        monetdb5/modules/kernel/group.mx
Branch: Apr2011
Log Message:

acknowledge that hash values are of type BUN, not of type int


diffs (41 lines):

diff --git a/monetdb5/modules/kernel/group.mx b/monetdb5/modules/kernel/group.mx
--- a/monetdb5/modules/kernel/group.mx
+++ b/monetdb5/modules/kernel/group.mx
@@ -299,10 +299,19 @@
 and 2-byte values by using direct mapping in an array instead of
 hashing.
 @c
+#if SIZEOF_BUN == SIZEOF_INT
+#define mix_BUN(v) mix_int(v)
+#else
+#define mix_BUN(v) mix_int((v)^((v)>>31))
+#endif
 #define HASH_bte(p) ((BUN) (*(unsigned char*) (p)))
 #define HASH_sht(p) ((BUN) (*(unsigned short*) (p)))
 #define HASH_int(p) ((BUN) *(unsigned int*) (p))
+#if SIZEOF_BUN == SIZEOF_LNG
+#define HASH_lng(p) ((BUN) (*(BUN *) (p)))
+#else
 #define HASH_lng(p) ((BUN)(((unsigned int*)(p))[0]^((unsigned int*)(p))[1]))
+#endif
 #define HASH_str_hv(p) (((BUN *) (p))[-1])
 #define HASH_any(p) ((*hashfcn)(p))
 
@@ -476,7 +485,7 @@
 
                /* hash-lookup of 'tcur' in map */
                BUN c = HASH_@1(tcur);
-               c = mix_int(c) & mask;
+               c = mix_BUN(c) & mask;
                chain_@4 {
                        r = zz;
                        e = (mapentry_t*) BUNhloc(mapi,r);
@@ -819,7 +828,7 @@
 
                /* hash-lookup of [hcur,tcur] in map */
                c = (((BUN) hcur) ^ HASH_@2(tcur));
-               c = mix_int(c) & mask;
+               c = mix_BUN(c) & mask;
                chain_@5 {
                        r = zz;
                        e = (mapentry_t*) Hloc(map,r);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to