2#include "gaia/config/config.h"
6#include "gaia/core/hashing_policy.h"
7#include "gaia/core/utility.h"
11 template <u
int32_t MaxLen>
25 static uint32_t len(
const char* pStr) {
30 GAIA_ASSERT2(
false,
"Only null-terminated strings up to MaxLen characters are supported");
34 static LookupHash calc(
const char* pStr, uint32_t len) {
35 return {
static_cast<uint32_t
>(core::calculate_hash64(pStr, len))};
39 static constexpr bool IsDirectHashKey =
true;
41 StringLookupKey(): m_pStr(
nullptr), m_len(0), m_owned(0), m_hash({0}) {}
50 m_pStr(pStr), m_len(len), m_owned(owned), m_hash(calc(pStr, len)) {}
58 m_pStr(pStr), m_len(len), m_owned(owned), m_hash(hash) {}
60 const char* str()
const {
64 uint32_t len()
const {
72 uint32_t hash()
const {
76 bool operator==(
const StringLookupKey& other)
const {
79 if GAIA_LIKELY (m_hash != other.m_hash)
83 if (m_len != other.m_len)
88 GAIA_ASSUME(l < MaxLen);
90 if (m_pStr[i] != other.m_pStr[i])
97 bool operator!=(
const StringLookupKey& other)
const {
98 return !operator==(other);
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9
Definition hashing_string.h:12
StringLookupKey(const char *pStr, uint32_t len, uint32_t owned)
Constructor calculating hash from the provided string pStr and len.
Definition hashing_string.h:49
StringLookupKey(const char *pStr, uint32_t len, uint32_t owned, LookupHash hash)
Constructor just for setting values.
Definition hashing_string.h:57