#ifndef HASH_INL_H_ #error "Direct inclusion of this file is not allowed, include hash.h" // For the sake of sane code completion. #include "hash.h" #endif #include namespace NYT { //////////////////////////////////////////////////////////////////////////////// inline void HashCombine(size_t& h, size_t k) { static_assert(sizeof(size_t) == 8, "size_t must be 64 bit."); const size_t m = 0xc6a4a7935bd1e995ULL; const int r = 47; k *= m; k ^= k >> r; k *= m; h ^= k; h *= m; } template void HashCombine(size_t& h, const T& k) { HashCombine(h, THash()(k)); } template Y_FORCE_INLINE size_t NaNSafeHash(const T& value) { return ::THash()(value); } template requires std::is_floating_point_v Y_FORCE_INLINE size_t NaNSafeHash(const T& value) { return std::isnan(value) ? 0 : ::THash()(value); } //////////////////////////////////////////////////////////////////////////////// template TRandomizedHash::TRandomizedHash() : Seed_(RandomNumber()) { } template size_t TRandomizedHash::operator ()(const TElement& element) const { return Underlying_(element) + Seed_; } //////////////////////////////////////////////////////////////////////////////// } // namespace NYT