14#ifndef OR_TOOLS_BASE_HASH_H_
15#define OR_TOOLS_BASE_HASH_H_
28static inline void mix(uint32_t&
a, uint32_t&
b, uint32_t& c) {
59static inline void mix(uint64_t&
a, uint64_t&
b, uint64_t& c) {
98 uint32_t
b = 0x9e3779b9UL;
104 uint64_t
b = uint64_t{0xe08c1d668b756f82};
112template <
class First,
class Second>
115 size_t h1 = hash<First>()(p.first);
116 size_t h2 = hash<Second>()(p.second);
118 return (
sizeof(h1) <=
sizeof(uint32_t))
125template <
class T, std::
size_t N>
129 uint64_t current = 71;
131 const T& elem = t[
index];
132 const uint64_t new_hash = hash<T>()(elem);
138 bool operator()(
const std::array<T, N>&
a,
const std::array<T, N>&
b)
const {
141 static const size_t bucket_size = 4;
142 static const size_t min_buckets = 8;
150inline uint64_t
Hash(uint64_t num, uint64_t c) {
151 uint64_t
b = uint64_t{0xe08c1d668b756f82};
156inline uint64_t
Hash(uint64_t
a, uint64_t
b, uint64_t c) {
Collection of objects used to extend the Constraint Solver library.
static void mix(uint32_t &a, uint32_t &b, uint32_t &c)
uint32_t Hash32NumWithSeed(uint32_t num, uint32_t c)
uint64_t Hash64NumWithSeed(uint64_t num, uint64_t c)
uint64_t Hash(uint64_t num, uint64_t c)
bool operator()(const std::array< T, N > &a, const std::array< T, N > &b) const
size_t operator()(const std::array< T, N > &t) const
size_t operator()(const std::pair< First, Second > &p) const