aboutsummaryrefslogtreecommitdiff
path: root/src/ptr_map.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2022-07-24 22:27:45 +0100
committerGitHub <noreply@github.com>2022-07-24 22:27:45 +0100
commit02a8bba02e6d5a499781dcb362803533c34ab1f1 (patch)
tree5aa0c61eed5fc1f6ed25d735641fb56246f6c806 /src/ptr_map.cpp
parent6ea68869c934807f1ecdc411e58bdce6b64ee7e2 (diff)
parenta3afe617c218736563723fd1ab343f403bdd33f0 (diff)
Merge branch 'master' into fix/freebsd-syscall
Diffstat (limited to 'src/ptr_map.cpp')
-rw-r--r--src/ptr_map.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ptr_map.cpp b/src/ptr_map.cpp
index 3d6be1d44..43e793b8a 100644
--- a/src/ptr_map.cpp
+++ b/src/ptr_map.cpp
@@ -28,11 +28,13 @@ struct PtrMap {
u32 ptr_map_hash_key(uintptr key) {
#if defined(GB_ARCH_64_BIT)
- u64 x = (u64)key;
- u8 count = (u8)(x >> 59);
- x ^= x >> (5 + count);
- x *= 12605985483714917081ull;
- return (u32)(x ^ (x >> 43));
+ key = (~key) + (key << 21);
+ key = key ^ (key >> 24);
+ key = (key + (key << 3)) + (key << 8);
+ key = key ^ (key >> 14);
+ key = (key + (key << 2)) + (key << 4);
+ key = key ^ (key << 28);
+ return cast(u32)key;
#elif defined(GB_ARCH_32_BIT)
u32 state = ((u32)key) * 747796405u + 2891336453u;
u32 word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;