Message326603
Also worth noting: other projects need to combine hashes too. Here's a 64-bit version of the highly regarded C++ Boost[1] library's hash_combine() function (I replaced its 32-bit int literal with "a random" 64-bit one):
x ^= (Py_uhash_t)y + 0x94ae1875aa5647f1UL + (x << 6) + (x >> 2);
It's very cheap. It also sucks horribly if used as the guts Python's tuple hash loop ;-)
This isn't a paradox. Best I can tell, Python may be unique in trying _not_ to make all hashes "look random". If you have only randomish hashes to combine, the Boost approach works fine. |
|
Date |
User |
Action |
Args |
2018-09-28 04:43:07 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, eric.smith, jdemeyer, sir-sigurd |
2018-09-28 04:43:07 | tim.peters | set | messageid: <1538109787.39.0.545547206417.issue34751@psf.upfronthosting.co.za> |
2018-09-28 04:43:07 | tim.peters | link | issue34751 messages |
2018-09-28 04:43:06 | tim.peters | create | |
|