18 for (
const uint8 *data =
reinterpret_cast<const uint8 *
>(inData); data < reinterpret_cast<const uint8 *>(inData) + inSize; ++data)
20 hash = hash ^
uint64(*data);
21 hash = hash * 0x100000001b3UL;
31 for (
const char *c = inString; *c != 0; ++c)
34 hash = 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 ioSeed ^=
Hash<T> { } (inValue) + 0x9e3779b9 + (ioSeed << 6) + (ioSeed >> 2);
165template <
typename FirstValue,
typename... Values>
179JPH_SUPPRESS_WARNING_PUSH
182#define JPH_MAKE_HASH_STRUCT(type, name, ...) \
183 struct [[nodiscard]] name \
185 ::JPH::uint64 operator()(const type &t) const \
187 return ::JPH::HashCombineArgs(__VA_ARGS__); \
191#define JPH_MAKE_HASHABLE(type, ...) \
192 JPH_SUPPRESS_WARNING_PUSH \
193 JPH_SUPPRESS_WARNINGS \
197 JPH_MAKE_HASH_STRUCT(type, Hash<type>, __VA_ARGS__) \
202 struct [[nodiscard]] hash<type> \
204 std::size_t operator()(const type &t) const \
206 return std::size_t(::JPH::Hash<type>{ }(t));\
210 JPH_SUPPRESS_WARNING_POP
212JPH_SUPPRESS_WARNING_POP
std::uint8_t uint8
Definition Core.h:454
std::uint64_t uint64
Definition Core.h:457
unsigned int uint
Definition Core.h:453
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_CLANG_SUPPRESS_WARNING(w)
Definition Core.h:263
std::uint32_t uint32
Definition Core.h:456
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
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:166
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