mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
[3.13] Fix comments for heapq.siftup_max
(GH-135359) (#136233)
Fix comments for `heapq.siftup_max` (GH-135359)
(cherry picked from commit 8f8bdf251a
)
Co-authored-by: Alper <alperyoney@fb.com>
Co-authored-by: mpage <mpage@meta.com>
This commit is contained in:
parent
1de8fc3e4b
commit
67c74398fa
1 changed files with 3 additions and 3 deletions
|
@ -445,11 +445,11 @@ siftup_max(PyListObject *heap, Py_ssize_t pos)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bubble up the smaller child until hitting a leaf. */
|
/* Bubble up the larger child until hitting a leaf. */
|
||||||
arr = _PyList_ITEMS(heap);
|
arr = _PyList_ITEMS(heap);
|
||||||
limit = endpos >> 1; /* smallest pos that has no child */
|
limit = endpos >> 1; /* smallest pos that has no child */
|
||||||
while (pos < limit) {
|
while (pos < limit) {
|
||||||
/* Set childpos to index of smaller child. */
|
/* Set childpos to index of larger child. */
|
||||||
childpos = 2*pos + 1; /* leftmost child position */
|
childpos = 2*pos + 1; /* leftmost child position */
|
||||||
if (childpos + 1 < endpos) {
|
if (childpos + 1 < endpos) {
|
||||||
PyObject* a = arr[childpos + 1];
|
PyObject* a = arr[childpos + 1];
|
||||||
|
@ -469,7 +469,7 @@ siftup_max(PyListObject *heap, Py_ssize_t pos)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Move the smaller child up. */
|
/* Move the larger child up. */
|
||||||
tmp1 = arr[childpos];
|
tmp1 = arr[childpos];
|
||||||
tmp2 = arr[pos];
|
tmp2 = arr[pos];
|
||||||
arr[childpos] = tmp2;
|
arr[childpos] = tmp2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue