1#include <Foundation/Strings/Implementation/StringBase.h>
5 template <
typename T,
bool isString>
8 static plUInt32 Hash(
const T& value);
14 PL_ALWAYS_INLINE
static plUInt32 Hash(
plStringView sString)
20 template <
typename T,
bool isString>
23 static_assert(isString,
"plHashHelper is not implemented for the given type.");
47 PL_ALWAYS_INLINE
static plUInt32 Hash(plUInt32 value)
51 return value * 2654435761U;
54 PL_ALWAYS_INLINE
static bool Equal(plUInt32 a, plUInt32 b) {
return a == b; }
62 PL_ALWAYS_INLINE
static bool Equal(plInt32 a, plInt32 b) {
return a == b; }
68 PL_ALWAYS_INLINE
static plUInt32 Hash(plUInt64 value)
71 plUInt32 a = plUInt32(value >> 32);
72 plUInt32 b = plUInt32(value);
73 return a ^ (b + 0x9e3779b9 + (a << 6) + (b >> 2));
76 PL_ALWAYS_INLINE
static bool Equal(plUInt64 a, plUInt64 b) {
return a == b; }
84 PL_ALWAYS_INLINE
static bool Equal(plInt64 a, plInt64 b) {
return a == b; }
90 PL_ALWAYS_INLINE
static plUInt32 Hash(
const char* szValue)
101 PL_ALWAYS_INLINE
static plUInt32 Hash(
plStringView sValue)
112 PL_ALWAYS_INLINE
static plUInt32 Hash(T* value)
114#if PL_ENABLED(PL_PLATFORM_64BIT)
121 PL_ALWAYS_INLINE
static bool Equal(T* a, T* b)
141 return static_cast<plUInt32
>(uiHash);
147 return ui0 ^ (ui1 + 0x9e3779b9 + (ui0 << 6) + (ui1 >> 2));
static constexpr plUInt32 CombineHashValues32(plUInt32 ui0, plUInt32 ui1)
Combines two 32 bit hash values into one.
Definition HashingUtils_inl.h:144
static constexpr plUInt64 xxHash64String(const char(&str)[N], plUInt64 uiSeed=0)
Calculates the 64bit xxHash of the given string literal at compile time.
static constexpr plUInt32 StringHashTo32(plUInt64 uiHash)
Truncates a 64 bit string hash to 32 bit.
Definition HashingUtils_inl.h:138
static constexpr plUInt64 StringHash(const char(&str)[N], plUInt64 uiSeed=0)
Calculates the hash of the given string literal at compile time.
static bool IsEqual(const char *pString1, const char *pString2, const char *pString1End=plUnicodeUtils::GetMaxStringEnd< char >(), const char *pString2End=plUnicodeUtils::GetMaxStringEnd< char >())
Returns true, if the two given strings are identical (bitwise).
Definition StringUtils_inl.h:125
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Helper struct to calculate the Hash of different types.
Definition HashingUtils.h:75
Definition StringBase.h:8
Base class which marks a class as containing string data.
Definition StringView.h:19