Changeset: 5b2675dd3b77 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5b2675dd3b77
Modified Files:
gdk/gdk_atoms.c
gdk/gdk_hash.h
Branch: default
Log Message:
Change calling sequence of mix_uuid to get rid of alignment warning.
And instead of copying 16 bytes onto the stack, we now only write an 8
byte pointer.
diffs (57 lines):
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -1328,7 +1328,7 @@ UUIDfromString(const char *svalue, size_
static BUN
UUIDhash(const void *v)
{
- return mix_uuid(*(const uuid *) v);
+ return mix_uuid((const uuid *) v);
}
static void *
diff --git a/gdk/gdk_hash.h b/gdk/gdk_hash.h
--- a/gdk/gdk_hash.h
+++ b/gdk/gdk_hash.h
@@ -202,23 +202,31 @@ HASHgetlink(const Hash *h, BUN i)
#define hash_dbl(H,V) hash_lng(H,V)
static inline BUN __attribute__((__const__))
-mix_uuid(uuid u)
+mix_uuid(const uuid *u)
{
ulng u1, u2;
- u1 = (ulng) (uint8_t) u.u[0] << 56 | (ulng) (uint8_t) u.u[1] << 48 |
- (ulng) (uint8_t) u.u[2] << 40 | (ulng) (uint8_t) u.u[3] << 32 |
- (ulng) (uint8_t) u.u[4] << 24 | (ulng) (uint8_t) u.u[5] << 16 |
- (ulng) (uint8_t) u.u[6] << 8 | (ulng) (uint8_t) u.u[7];
- u2 = (ulng) (uint8_t) u.u[8] << 56 | (ulng) (uint8_t) u.u[9] << 48 |
- (ulng) (uint8_t) u.u[10] << 40 | (ulng) (uint8_t) u.u[11] << 32
|
- (ulng) (uint8_t) u.u[12] << 24 | (ulng) (uint8_t) u.u[13] << 16
|
- (ulng) (uint8_t) u.u[14] << 8 | (ulng) (uint8_t) u.u[15];
+ u1 = (ulng) (uint8_t) u->u[0] << 56 |
+ (ulng) (uint8_t) u->u[1] << 48 |
+ (ulng) (uint8_t) u->u[2] << 40 |
+ (ulng) (uint8_t) u->u[3] << 32 |
+ (ulng) (uint8_t) u->u[4] << 24 |
+ (ulng) (uint8_t) u->u[5] << 16 |
+ (ulng) (uint8_t) u->u[6] << 8 |
+ (ulng) (uint8_t) u->u[7];
+ u2 = (ulng) (uint8_t) u->u[8] << 56 |
+ (ulng) (uint8_t) u->u[9] << 48 |
+ (ulng) (uint8_t) u->u[10] << 40 |
+ (ulng) (uint8_t) u->u[11] << 32 |
+ (ulng) (uint8_t) u->u[12] << 24 |
+ (ulng) (uint8_t) u->u[13] << 16 |
+ (ulng) (uint8_t) u->u[14] << 8 |
+ (ulng) (uint8_t) u->u[15];
/* we're not using mix_hge since this way we get the same result
* on systems with and without 128 bit integer support */
return (BUN) (mix_lng(u1) ^ mix_lng(u2));
}
-#define hash_uuid(H,V) HASHbucket(H, mix_uuid(*(const uuid *) (V)))
+#define hash_uuid(H,V) HASHbucket(H, mix_uuid((const uuid *) (V)))
/*
* @- hash-table supported loop over BUNs The first parameter `bi' is
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list