[issue16427] Faster hash implementation

Gregory P. Smith report at bugs.python.org
Tue Apr 9 18:23:16 CEST 2013


Gregory P. Smith added the comment:

> > Note that the patch uses type punning through a union
>
> What is the standard and portable way to cast an array of bytes to size_t?

I'd expect just casting the pointer type before dereferencing:

unsigned char *p;
...
hash = (multiplier * hash) ^ *((Py_uhash_t *)p);

(don't use size_t, use Py_uhash_t)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16427>
_______________________________________


More information about the Python-bugs-list mailing list