Skip to content

Commit 4f9fc76

Browse files
committed
Unroll second digit calculation in long_hash
1 parent a162da2 commit 4f9fc76

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Objects/longobject.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3682,6 +3682,10 @@ long_hash(PyObject *obj)
36823682
--i;
36833683
x = v->long_value.ob_digit[i];
36843684
assert(x < _PyHASH_MODULUS);
3685+
--i;
3686+
x = ((x << PyLong_SHIFT));
3687+
x += v->long_value.ob_digit[i];
3688+
assert(x < _PyHASH_MODULUS);
36853689

36863690
while (--i >= 0) {
36873691
/* Here x is a quantity in the range [0, _PyHASH_MODULUS); we

0 commit comments

Comments
 (0)