Currently Boost has hash_combine function that outputs 32 bit unsigned integer (to be precise, size_t). Some references:
http://www.boost.org/doc/libs/1_43_0/doc/html/hash/reference.html#boost.hash_combine
http://www.boost.org/doc/libs/1_43_0/doc/html/hash/combine.html
Magic number in boost::hash_combine
I'd like to explore on how to create 64 bit version of hash_combine.
The first thing is to get golden ratio or any other irrational number in 64 bit.
The second part is to use shifts. This part rather tricky and I'd like to ask if there are best practices or guide on using shifts to get hash values? Or choosing shifts like the original code:
seed ^= hash_value(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
is totally random?
Also how to evaluate the output of hash_combine
to make sure that it doesn't create more collisions than the original hash function hash_value
?