mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +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
|
guint
|
||||||
g_int64_hash (gconstpointer v)
|
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
|
guint
|
||||||
g_double_hash (gconstpointer v)
|
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