Line data Source code
1 : /*
2 : * Utilities for working with hash values.
3 : *
4 : * Portions Copyright (c) 2017, PostgreSQL Global Development Group
5 : */
6 :
7 : #ifndef HASHUTILS_H
8 : #define HASHUTILS_H
9 :
10 : /*
11 : * Combine two hash values, resulting in another hash value, with decent bit
12 : * mixing.
13 : *
14 : * Similar to boost's hash_combine().
15 : */
16 : static inline uint32
17 29046 : hash_combine(uint32 a, uint32 b)
18 : {
19 29046 : a ^= b + 0x9e3779b9 + (a << 6) + (a >> 2);
20 29046 : return a;
21 : }
22 :
23 : #endif /* HASHUTILS_H */
|