#pragma once #include #include #include // IWYU pragma: keep std::hash // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-identifier-length) namespace jvalidate::compat { // Taken from boostorg/container_hash // https://github.com/boostorg/container_hash/blob/2698b43803c012601e6bb1a6116e83767b97986c/include/boost/container_hash/detail/hash_mix.hpp#L67-L81 inline std::size_t hash_mix(std::size_t x) { static_assert(sizeof(std::size_t) == 8); constexpr static std::uint64_t m = 0xe9846af9b1a615d; x ^= x >> 32; x *= m; x ^= x >> 32; x *= m; x ^= x >> 28; return x; } // Taken from boostorg/container_hash // https://github.com/boostorg/container_hash/blob/2698b43803c012601e6bb1a6116e83767b97986c/include/boost/container_hash/hash.hpp#L474-L477 template inline void hash_combine(std::size_t & seed, T const & v) { seed = hash_mix(seed + 0x9e3779b9 + std::hash()(v)); } } // NOLINTEND(cppcoreguidelines-avoid-magic-numbers,readability-identifier-length)