From 888b7b5dcea20a3f7a4753ad982925860684521c Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 18 Jan 2024 01:11:10 +0000 Subject: [PATCH] Add a simple 64 bit to 64 bit hash (from MurmurHash3) --- src/core/hash_func.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/core/hash_func.hpp b/src/core/hash_func.hpp index 28d09ad46e..eb35ea4382 100644 --- a/src/core/hash_func.hpp +++ b/src/core/hash_func.hpp @@ -25,4 +25,19 @@ inline uint32_t SimpleHash32(uint32_t h) return h; } +/** + * Simple 64 bit to 64 bit hash + * From MurmurHash3 + */ +inline uint64_t SimpleHash64(uint64_t h) +{ + h ^= h >> 33; + h *= 0xff51afd7ed558ccdULL; + h ^= h >> 33; + h *= 0xc4ceb9fe1a85ec53ULL; + h ^= h >> 33; + + return h; +} + #endif /* HASH_FUNC_HPP */