18 for (
const uint8 *data =
reinterpret_cast<const uint8 *
>(inData); data < reinterpret_cast<const uint8 *>(inData) + inSize; ++data)
21 hash *= 0x100000001b3UL;
31 for (
const char *c = inString; *c != 0; ++c)
34 hash *= 0x100000001b3UL;
46 hash = (~hash) + (hash << 21);
47 hash = hash ^ (hash >> 24);
48 hash = (hash + (hash << 3)) + (hash << 8);
49 hash = hash ^ (hash >> 14);
50 hash = (hash + (hash << 2)) + (hash << 4);
51 hash = hash ^ (hash >> 28);
52 hash = hash + (hash << 31);
62 return inValue.GetHash();
72 float value = inValue == 0.0f? 0.0f : inValue;
83 double value = inValue == 0.0? 0.0 : inValue;
124 return HashBytes(&inValue,
sizeof(inValue));
129#define JPH_DEFINE_TRIVIAL_HASH(type) \
133 uint64 operator () (const type &inValue) const \
135 return HashBytes(&inValue, sizeof(inValue)); \
150 constexpr uint64 c = 0xbea225f9eb34556dUL;
186template <
typename FirstValue,
typename... Values>
198#define JPH_MAKE_HASH_STRUCT(type, name, ...) \
199 struct [[nodiscard]] name \
201 ::JPH::uint64 operator()(const type &t) const \
203 return ::JPH::HashCombineArgs(__VA_ARGS__); \
207#define JPH_MAKE_STD_HASH(type) \
208 JPH_SUPPRESS_WARNING_PUSH \
209 JPH_SUPPRESS_WARNINGS \
213 struct [[nodiscard]] hash<type> \
215 size_t operator()(const type &t) const \
217 return size_t(::JPH::Hash<type>{ }(t)); \
221 JPH_SUPPRESS_WARNING_POP
223#define JPH_MAKE_HASHABLE(type, ...) \
224 JPH_SUPPRESS_WARNING_PUSH \
225 JPH_SUPPRESS_WARNINGS \
229 JPH_MAKE_HASH_STRUCT(type, Hash<type>, __VA_ARGS__) \
231 JPH_SUPPRESS_WARNING_POP \
232 JPH_MAKE_STD_HASH(type)
std::uint8_t uint8
Definition Core.h:482
std::uint64_t uint64
Definition Core.h:485
unsigned int uint
Definition Core.h:481
#define JPH_NAMESPACE_END
Definition Core.h:414
std::uint32_t uint32
Definition Core.h:484
#define JPH_NAMESPACE_BEGIN
Definition Core.h:408
constexpr uint64 HashString(const char *inString, uint64 inSeed=0xcbf29ce484222325UL)
Definition HashCombine.h:28
JPH_NAMESPACE_BEGIN uint64 HashBytes(const void *inData, uint inSize, uint64 inSeed=0xcbf29ce484222325UL)
Definition HashCombine.h:15
uint64 HashCombineArgs(const FirstValue &inFirstValue, Values... inValues)
Definition HashCombine.h:187
uint64 Hash64(uint64 inValue)
Definition HashCombine.h:43
void HashCombine(uint64 &ioSeed, const T &inValue)
Commonly used types.
Definition HashCombine.h:148
#define JPH_DEFINE_TRIVIAL_HASH(type)
Helper macro to define a hash function for trivial types.
Definition HashCombine.h:129
std::basic_string< char, std::char_traits< char >, STLAllocator< char > > String
Definition STLAllocator.h:107
Fallback hash function that calls T::GetHash()
Definition HashCombine.h:59
uint64 operator()(const T &inValue) const
Definition HashCombine.h:60