Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:

[Antoine]
> Ok, updated patch:
> - uses a 4-bit rotate (not shift)
> - avoids comparing an unsigned long to -1
> - tries to streamline the win64 special path (but I can't test)

pointer_hash4.patch looks fine to me.  Still, I think it's worth
considering the simpler and faster:  x |= x>>4.  The latter doesn't
require any special-casing for various pointer sizes.  It just works.

[Adam]
> Adding an arbitrary set of OR, XOR, or add makes me uneasy;
> I know enough to do them wrong (reduce entropy), but not 
> enough to do them right.

It's easy enough to prove (just show that the function is reversible)
and easy enough to test:

   assert len(set(ids)) == len(set(map(f, set(ids)))) # for any large
group of ids

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5186>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to