Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Docs: A couple more things.
  • Loading branch information
xuxinhang committed Dec 24, 2021
commit c359521056e3078b16f73a24c24a90e63784dc08
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`.
Comment thread
mdickinson marked this conversation as resolved.
Outdated
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