Skip to content

Commit fd4ce81

Browse files
committed
Comment updates
1 parent b3a1a8f commit fd4ce81

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Objects/longobject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4511,8 +4511,8 @@ long_rshift1(PyLongObject *a, Py_ssize_t wordshift, digit remshift)
45114511
size_a = Py_ABS(Py_SIZE(a));
45124512

45134513
if (a_negative) {
4514-
/* For shifting negative integers, it's convenient to adjust so that
4515-
0 < remshift <= PyLong_SHIFT. */
4514+
/* For 'a', adjust so that 0 < remshift <= PyLong_SHIFT. This ensures
4515+
that 'newsize' is computed correctly below. */
45164516
if (remshift == 0) {
45174517
remshift = PyLong_SHIFT;
45184518
--wordshift;
@@ -4526,6 +4526,7 @@ long_rshift1(PyLongObject *a, Py_ssize_t wordshift, digit remshift)
45264526
assert(wordshift >= 0);
45274527
newsize = size_a - wordshift;
45284528
if (newsize <= 0) {
4529+
/* Shifting all the bits of 'a' out gives either -1 or 0. */
45294530
return PyLong_FromLong(-a_negative);
45304531
}
45314532
z = _PyLong_New(newsize);

0 commit comments

Comments
 (0)