From 8f160c5ef7a505f90ddfb265c165ae9ffbe52fbd Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Wed, 30 Oct 2024 10:48:09 +0100 Subject: [PATCH] hashlib: don't xorshift in between upper and lower word --- kernel/hashlib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/hashlib.h b/kernel/hashlib.h index 13b53e383..33a1e04f8 100644 --- a/kernel/hashlib.h +++ b/kernel/hashlib.h @@ -99,17 +99,18 @@ class Hasher { [[nodiscard]] static uint32_t mkhash(uint32_t a, uint32_t b) { uint32_t hash = ((a << 5) + a) ^ b; - hash = mkhash_xorshift(fudge ^ hash); return hash; } public: void hash32(uint32_t i) { state = mkhash(i, state); + state = mkhash_xorshift(fudge ^ state); return; } void hash64(uint64_t i) { state = mkhash((uint32_t)(i % (1ULL << 32ULL)), state); state = mkhash((uint32_t)(i >> 32ULL), state); + state = mkhash_xorshift(fudge ^ state); return; } [[nodiscard]]