mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Consolidate the occurrances of the prime used as the multiplier when hashing
to a single #define instead of having several copies in several files. This excludes the Modules/ tree (datetime and expat both have a copy for their own purposes with no need for it to be the same).
This commit is contained in:
parent
515687a7ed
commit
63e6c3222f
4 changed files with 7 additions and 4 deletions
|
@ -881,7 +881,7 @@ bytes_hash(PyBytesObject *a)
|
|||
p = (unsigned char *) a->ob_sval;
|
||||
x = *p << 7;
|
||||
while (--len >= 0)
|
||||
x = (1000003*x) ^ *p++;
|
||||
x = (_PyHASH_MULTIPLIER*x) ^ *p++;
|
||||
x ^= Py_SIZE(a);
|
||||
if (x == -1)
|
||||
x = -2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue