4 constexpr plUInt32 MURMUR_M = 0x5bd1e995;
5 constexpr plUInt32 MURMUR_R = 24;
7 template <
size_t N,
size_t Loop>
10 constexpr PL_ALWAYS_INLINE plUInt32 operator()(plUInt32 uiHash,
const char (&str)[N],
size_t i)
const
19 static constexpr PL_ALWAYS_INLINE plUInt32 helper(plUInt32 k) {
return (k ^ (k >> MURMUR_R)) * MURMUR_M; }
21 constexpr PL_ALWAYS_INLINE plUInt32 operator()(plUInt32 uiHash,
const char (&str)[N],
size_t i)
const
31 return (uiHash * MURMUR_M) ^ helper(((str[i + 0]) | ((str[i + 1]) << 8) | ((str[i + 2]) << 16) | ((str[i + 3]) << 24)) * MURMUR_M);
38 constexpr PL_ALWAYS_INLINE plUInt32 operator()(plUInt32 uiHash,
const char (&str)[N],
size_t i)
const
40 return (uiHash ^ (str[i + 2] << 16) ^ (str[i + 1] << 8) ^ (str[i + 0])) * MURMUR_M;
47 constexpr PL_ALWAYS_INLINE plUInt32 operator()(plUInt32 uiHash,
const char (&str)[N],
size_t i)
const
49 return (uiHash ^ (str[i + 1] << 8) ^ (str[i])) * MURMUR_M;
56 constexpr PL_ALWAYS_INLINE plUInt32 operator()(plUInt32 uiHash,
const char (&str)[N],
size_t i)
const {
return (uiHash ^ (str[i])) * MURMUR_M; }
62 constexpr PL_ALWAYS_INLINE plUInt32 operator()(plUInt32 uiHash,
const char (&str)[N],
size_t i)
const {
return uiHash; }
65 constexpr plUInt32 rightShift_and_xorWithPrevSelf(plUInt32 h, plUInt32 uiShift)
67 return h ^ (h >> uiShift);
83 return plInternal::rightShift_and_xorWithPrevSelf(
static plUInt32 MurmurHash32(const void *pKey, size_t uiSizeInByte, plUInt32 uiSeed=0)
Calculates the 32bit murmur hash of the given key.
Definition HashingUtils.cpp:6
static constexpr plUInt32 MurmurHash32String(const char(&str)[N], plUInt32 uiSeed=0)
Calculates the 32bit murmur hash of a string constant at compile time. Encoding does not matter here.
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
plUInt32 GetElementCount() const
Returns the number of bytes from the start position up to its end.
Definition StringView.h:93
const char * GetStartPointer() const
Returns the start of the view range.
Definition StringView.h:102
Definition HashingMurmur_inl.h:9