gh-111389: Add PyHASH_MULTIPLIER constant (#119214)

This commit is contained in:
Victor Stinner 2024-05-21 19:51:51 +02:00 committed by GitHub
parent 87939bd579
commit f6da790122
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 16 additions and 7 deletions

View file

@ -263,12 +263,12 @@ fnv(const void *src, Py_ssize_t len)
x ^= (Py_uhash_t) *p << 7;
while (blocks--) {
PY_UHASH_CPY(block.bytes, p);
x = (_PyHASH_MULTIPLIER * x) ^ block.value;
x = (PyHASH_MULTIPLIER * x) ^ block.value;
p += SIZEOF_PY_UHASH_T;
}
/* add remainder */
for (; remainder > 0; remainder--)
x = (_PyHASH_MULTIPLIER * x) ^ (Py_uhash_t) *p++;
x = (PyHASH_MULTIPLIER * x) ^ (Py_uhash_t) *p++;
x ^= (Py_uhash_t) len;
x ^= (Py_uhash_t) _Py_HashSecret.fnv.suffix;
if (x == (Py_uhash_t) -1) {