12 #ifndef CPROVER_UTIL_IREP_HASH_H
13 #define CPROVER_UTIL_IREP_HASH_H
17 #define IREP_HASH_BASIC
43 # define FORCE_INLINE __forceinline
48 # define ROTL32(x, y) _rotl(x, y)
49 # define ROTL64(x, y) _rotl64(x, y)
51 # define BIG_CONSTANT(x) (x)
55 # define FORCE_INLINE inline __attribute__((always_inline))
61 return (x <<
r) | (x >> (32-
r));
66 return (x <<
r) | (x >> (64-
r));
69 # define BIG_CONSTANT(x) (x##LLU)
74 #ifdef IREP_HASH_BASIC
86 return ROTL32(h1, 7)^h2;
103 unsigned int int_value=(unsigned)h1;
104 return ROTL32(int_value, 7)^h2;
106 return ROTL64(h1, 7)^h2;
121 # define hash_combine(h1, h2) \
122 basic_hash_combine<sizeof(std::size_t) * CHAR_BIT>(h1, h2)
123 # define hash_finalize(h1, len) basic_hash_finalize(h1, len)
128 #ifdef IREP_HASH_MURMURHASH2A
136 std::size_t murmurhash2a_hash_combine(
141 std::size_t murmurhash2a_hash_finalize(
145 static FORCE_INLINE uint32_t mmix32(uint32_t h1, uint32_t h2)
148 const uint32_t m=0x5bd1e995;
160 inline std::size_t murmurhash2a_hash_combine<32>(
164 return mmix32(h1, h2);
169 inline std::size_t murmurhash2a_hash_finalize<32>(
173 const uint32_t m=0x5bd1e995;
184 static FORCE_INLINE uint64_t mmix64(uint64_t h1, uint64_t h2)
187 const uint64_t m=0xc6a4a7935bd1e995;
201 inline std::size_t murmurhash2a_hash_combine<64>(
205 return mmix64(h1, h2);
210 inline std::size_t murmurhash2a_hash_finalize<64>(
215 const uint64_t m=0xc6a4a7935bd1e995;
227 # define hash_combine(h1, h2) \
228 murmurhash2a_hash_combine<sizeof(std::size_t) * CHAR_BIT>(h1, h2)
229 # define hash_finalize(h1, len) \
230 murmurhash2a_hash_finalize<sizeof(std::size_t) * CHAR_BIT>(h1, len)
235 #ifdef IREP_HASH_MURMURHASH3
243 std::size_t murmurhash3_hash_combine(
248 std::size_t murmurhash3_hash_finalize(
253 inline std::size_t murmurhash3_hash_combine<32>(
257 const uint32_t c1=0xcc9e2d51;
258 const uint32_t c2=0x1b873593;
284 inline std::size_t murmurhash3_hash_finalize<32>(
294 inline std::size_t murmurhash3_hash_combine<64>(
298 const std::size_t h1_tmp=h1;
334 inline std::size_t murmurhash3_hash_finalize<64>(
343 # define hash_combine(h1, h2) \
344 murmurhash3_hash_combine<sizeof(std::size_t) * CHAR_BIT>(h1, h2)
345 # define hash_finalize(h1, len) \
346 murmurhash3_hash_finalize<sizeof(std::size_t) * CHAR_BIT>(h1, len)
std::size_t basic_hash_finalize(std::size_t h1, std::size_t len)
std::size_t basic_hash_combine(std::size_t h1, std::size_t h2)
std::size_t basic_hash_combine< 64 >(std::size_t h1, std::size_t h2)
std::size_t basic_hash_combine< 32 >(std::size_t h1, std::size_t h2)