14inline constexpr uint32_t
murmur3(uint32_t h)
noexcept {
15 h ^= h >> UINT32_C(16);
16 h *= UINT32_C(0x85ebca6b);
17 h ^= h >> UINT32_C(13);
18 h *= UINT32_C(0xc2b2ae35);
19 h ^= h >> UINT32_C(16);
23inline constexpr uint64_t
splitmix64(uint64_t h)
noexcept {
24 h ^= h >> UINT64_C(30);
25 h *= UINT64_C(0xbf58476d1ce4e5b9);
26 h ^= h >> UINT64_C(27);
27 h *= UINT64_C(0x94d049bb133111eb);
28 h ^= h >> UINT64_C(31);
32inline constexpr size_t hash(
size_t h)
noexcept {
33 if constexpr (
sizeof(size_t) == 4)
35 else if constexpr (
sizeof(size_t) == 8)
38 static_assert(
"unsupported size of size_t");
46template<
size_t>
struct FNV1 {};
49 static const uint32_t
offset = UINT32_C(2166136261);
50 static const uint32_t
prime = UINT32_C(16777619);
54 static const uint64_t
offset = UINT64_C(14695981039346656037);
55 static const uint64_t
prime = UINT64_C(1099511628211);
58template<
class T>
constexpr size_t hash_combine(
size_t seed, T v)
noexcept {
59 static_assert(std::is_signed<T>::value || std::is_unsigned<T>::value,
"please provide your own hash function");
62 for (
size_t i = 0; i <
sizeof(T); ++i) {
63 size_t octet = val & size_t(0xff);
65 seed *=
FNV1<
sizeof(size_t)>::prime;
71inline consteval size_t hash_begin() noexcept {
return FNV1<
sizeof(size_t)>::offset; }
constexpr size_t hash_combine(size_t seed, T v) noexcept
constexpr uint64_t splitmix64(uint64_t h) noexcept
consteval size_t hash_begin() noexcept
constexpr size_t hash(size_t h) noexcept
constexpr uint32_t murmur3(uint32_t h) noexcept
static const uint32_t offset
static const uint32_t prime
static const uint64_t offset
static const uint64_t prime