Skip to content

Commit f92f3f8

Browse files
committed
Now even faster!
1 parent d0f1958 commit f92f3f8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Objects/longobject.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4491,7 +4491,6 @@ long_rshift1(PyLongObject *a, Py_ssize_t wordshift, digit remshift)
44914491
{
44924492
PyLongObject *z = NULL;
44934493
Py_ssize_t newsize, hishift, i, j;
4494-
digit lobits, next;
44954494

44964495
if (Py_SIZE(a) < 0) {
44974496
/* Right shifting negative numbers is harder */
@@ -4515,13 +4514,13 @@ long_rshift1(PyLongObject *a, Py_ssize_t wordshift, digit remshift)
45154514
if (z == NULL)
45164515
return NULL;
45174516
j = wordshift;
4518-
lobits = a->ob_digit[j++] >> remshift;
4517+
twodigits acc = a->ob_digit[j++] >> remshift;
45194518
for (i = 0; j < Py_SIZE(a); i++, j++) {
4520-
next = a->ob_digit[j];
4521-
z->ob_digit[i] = (lobits | next << hishift) & PyLong_MASK;
4522-
lobits = next >> remshift;
4519+
acc |= ((twodigits)(a->ob_digit[j]) << hishift);
4520+
z->ob_digit[i] = acc & PyLong_MASK;
4521+
acc >>= PyLong_SHIFT;
45234522
}
4524-
z->ob_digit[i] = lobits;
4523+
z->ob_digit[i] = acc;
45254524
z = maybe_small_long(long_normalize(z));
45264525
}
45274526
return (PyObject *)z;

0 commit comments

Comments
 (0)