mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
follow up to #9778: define and use an unsigned hash type
This commit is contained in:
parent
2b9af63b4f
commit
8035bc5c04
7 changed files with 22 additions and 20 deletions
|
@ -318,7 +318,7 @@ tuplehash(PyTupleObject *v)
|
|||
register Py_hash_t x, y;
|
||||
register Py_ssize_t len = Py_SIZE(v);
|
||||
register PyObject **p;
|
||||
long mult = 1000003L;
|
||||
Py_hash_t mult = 1000003L;
|
||||
x = 0x345678L;
|
||||
p = v->ob_item;
|
||||
while (--len >= 0) {
|
||||
|
@ -327,7 +327,7 @@ tuplehash(PyTupleObject *v)
|
|||
return -1;
|
||||
x = (x ^ y) * mult;
|
||||
/* the cast might truncate len; that doesn't change hash stability */
|
||||
mult += (long)(82520L + len + len);
|
||||
mult += (Py_hash_t)(82520L + len + len);
|
||||
}
|
||||
x += 97531L;
|
||||
if (x == -1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue