diff options
Diffstat (limited to 'deimos/core/hash.h')
-rw-r--r-- | deimos/core/hash.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/deimos/core/hash.h b/deimos/core/hash.h index f1e8958..6ad30b0 100644 --- a/deimos/core/hash.h +++ b/deimos/core/hash.h @@ -5,7 +5,7 @@ namespace deimos
{
-constexpr uint64 MurmurHash3_GetBlock64(const char* key, uint64 block)
+constexpr uint64 MurmurHash3_GetBlock64(const byte* key, uint64 block)
{
// NOLINTBEGIN
key += block * 8;
@@ -41,12 +41,11 @@ constexpr uint64 MurmurHash3_Fmix64(uint64 k) return k;
}
-constexpr uint128 MurmurHash3_x64_128(const char* key)
+constexpr uint128 MurmurHash3_x64_128(const byte* key, uint64 len)
{
if consteval { return { 12, 12 }; }
// NOLINTBEGIN
- const uint64 len = __builtin_strlen(key);
const uint64 nblocks = len / 16;
const int64 seed = 0;
@@ -73,7 +72,7 @@ constexpr uint128 MurmurHash3_x64_128(const char* key) //----------
// tail
- const char* tail = key + nblocks * 16;
+ const byte* tail = key + nblocks * 16;
uint64 k1 = 0;
uint64 k2 = 0;
@@ -118,5 +117,10 @@ constexpr uint128 MurmurHash3_x64_128(const char* key) return uint128{h1, h2};
}
+constexpr uint128 MurmurHash3_x64_128(gsl::czstring str)
+{
+ return MurmurHash3_x64_128(BitCast<const byte*>(str), __builtin_strlen(str));
+}
+
} // namespace deimos
|