mirror of
https://github.com/python/cpython.git
synced 2025-12-10 11:00:14 +00:00
reorder and save a comparison
This commit is contained in:
parent
de6e9d615d
commit
0538064554
1 changed files with 5 additions and 5 deletions
|
|
@ -1934,17 +1934,17 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reverse sort stability achieved by initially reversing the list,
|
|
||||||
applying a stable forward sort, then reversing the final result. */
|
|
||||||
if (reverse && saved_ob_size > 1)
|
|
||||||
reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size);
|
|
||||||
|
|
||||||
merge_init(&ms);
|
merge_init(&ms);
|
||||||
|
|
||||||
nremaining = saved_ob_size;
|
nremaining = saved_ob_size;
|
||||||
if (nremaining < 2)
|
if (nremaining < 2)
|
||||||
goto succeed;
|
goto succeed;
|
||||||
|
|
||||||
|
/* Reverse sort stability achieved by initially reversing the list,
|
||||||
|
applying a stable forward sort, then reversing the final result. */
|
||||||
|
if (reverse)
|
||||||
|
reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size);
|
||||||
|
|
||||||
/* March over the array once, left to right, finding natural runs,
|
/* March over the array once, left to right, finding natural runs,
|
||||||
* and extending short natural runs to minrun elements.
|
* and extending short natural runs to minrun elements.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue