We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 146f5aa commit a162da2Copy full SHA for a162da2
Objects/longobject.c
@@ -3676,7 +3676,13 @@ long_hash(PyObject *obj)
3676
}
3677
i = _PyLong_DigitCount(v);
3678
sign = _PyLong_NonCompactSign(v);
3679
- x = 0;
+
3680
+ // unroll first two digits
3681
+ assert(i>=2);
3682
+ --i;
3683
+ x = v->long_value.ob_digit[i];
3684
+ assert(x < _PyHASH_MODULUS);
3685
3686
while (--i >= 0) {
3687
/* Here x is a quantity in the range [0, _PyHASH_MODULUS); we
3688
want to compute x * 2**PyLong_SHIFT + v->long_value.ob_digit[i] modulo
0 commit comments