mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
Merge branch 'wip/smcv/64-bit-hash' into 'main'
ghash: Correctly retrieve low 32 bits of 64-bit values Closes #2787 See merge request GNOME/glib!2994
This commit is contained in:
commit
e33f23a6b5
@ -2496,7 +2496,9 @@ g_int64_equal (gconstpointer v1,
|
||||
guint
|
||||
g_int64_hash (gconstpointer v)
|
||||
{
|
||||
return (guint) ((const guint) (*(guint64 *) v >> 32)) ^ (*(const guint *) v);
|
||||
const guint64 *bits = v;
|
||||
|
||||
return (guint) ((*bits >> 32) ^ (*bits & 0xffffffffU));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2537,5 +2539,8 @@ g_double_equal (gconstpointer v1,
|
||||
guint
|
||||
g_double_hash (gconstpointer v)
|
||||
{
|
||||
return (guint) ((const guint) (*(guint64 *) v >> 32)) ^ (*(const guint *) v);
|
||||
/* Same as g_int64_hash() */
|
||||
const guint64 *bits = v;
|
||||
|
||||
return (guint) ((*bits >> 32) ^ (*bits & 0xffffffffU));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user