From 942245397e6c2f3e6642b29a3be2cae999aab16d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 27 Feb 2023 07:55:57 +0100 Subject: compat: replace int hash --- compat/int-hash.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/compat/int-hash.hpp b/compat/int-hash.hpp index 43b92605..36f0c8b8 100644 --- a/compat/int-hash.hpp +++ b/compat/int-hash.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include namespace floormat { @@ -16,12 +17,12 @@ constexpr inline std::size_t int_hash(std::size_t x) noexcept } else if constexpr(sizeof(std::size_t) == 8) { - // splitmix64 by George Marsaglia - x ^= x >> 30; - x *= 0xbf58476d1ce4e5b9U; - x ^= x >> 27; - x *= 0x94d049bb133111ebU; - x ^= x >> 31; + // NASAM by Pelle Evensen + x ^= std::rotr(x, 25) ^ std::rotr(x, 47); + x *= 0x9E6C63D0676A9A99UL; + x ^= x >> 23 ^ x >> 51; + x *= 0x9E6D62D06F6A9A9BUL; + x ^= x >> 23 ^ x >> 51; } return x; -- cgit v1.2.3