Tim Peters <[email protected]> added the comment:
Perhaps worth noting that FNV-1a works great if used as _intended_: on a
stream of unsigned bytes. All tests except the new tuple hash test suffer no
collisions; the new test suffers 14. Nothing is needed to try to worm around
nested tuple catastrophes, or to worm around mixing integers of similar
magnitude but different signs. The obvious downside: on a 64-bit box, it's 8
times as many multiplies :-( Here's a 64-bit version:
Py_uhash_t t = (Py_uhash_t)y;
for (int i = 0; i < sizeof(t); ++i) {
x = (x ^ (t & 0xff)) * (Py_uhash_t)1099511628211ULL;
t >>= 8;
}
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34751>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com