Skip to content

Commit

Permalink
Docs: A couple more things.
Browse files Browse the repository at this point in the history
  • Loading branch information
xuxinhang committed Dec 24, 2021
1 parent b7ad599 commit c359521
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,7 @@ Doug Wyatt
Xiang Zhang
Robert Xiao
Florent Xicluna
Xinhang Xu
Arnon Yaari
Alakshendra Yadav
Hirokazu Yamamoto
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Speed up shifting operation involving integrates less than
:c:macro:`PyLong_BASE`.
10 changes: 5 additions & 5 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4507,14 +4507,14 @@ long_rshift1(PyLongObject *a, Py_ssize_t wordshift, digit remshift)
if (Py_SIZE(a) < 0) {
/* Right shifting negative numbers is harder */
PyLongObject *a1, *a2;
a1 = (PyLongObject *)long_invert(a);
a1 = (PyLongObject *) long_invert(a);
if (a1 == NULL)
return NULL;
a2 = (PyLongObject *)long_rshift1(a1, wordshift, remshift);
a2 = (PyLongObject *) long_rshift1(a1, wordshift, remshift);
Py_DECREF(a1);
if (a2 == NULL)
return NULL;
z = (PyLongObject *)long_invert(a2);
z = (PyLongObject *) long_invert(a2);
Py_DECREF(a2);
}
else {
Expand All @@ -4529,8 +4529,8 @@ long_rshift1(PyLongObject *a, Py_ssize_t wordshift, digit remshift)
return NULL;
for (i = 0, j = wordshift; i < newsize; i++, j++) {
z->ob_digit[i] = (a->ob_digit[j] >> remshift) & lomask;
if (i + 1 < newsize)
z->ob_digit[i] |= (a->ob_digit[j + 1] << hishift) & himask;
if (i+1 < newsize)
z->ob_digit[i] |= (a->ob_digit[j+1] << hishift) & himask;
}
z = maybe_small_long(long_normalize(z));
}
Expand Down

0 comments on commit c359521

Please sign in to comment.