[Python-checkins] cpython: Convert another post-decrement while-loop to pre-decrement for consistency
raymond.hettinger
python-checkins at python.org
Sun Jan 24 15:40:47 EST 2016
https://hg.python.org/cpython/rev/f700bc0412bc
changeset: 100061:f700bc0412bc
user: Raymond Hettinger <python at rcn.com>
date: Sun Jan 24 12:40:42 2016 -0800
summary:
Convert another post-decrement while-loop to pre-decrement for consistency
and better generated code (on both GCC and CLang).
files:
Modules/_collectionsmodule.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -895,7 +895,8 @@
Py_ssize_t n = Py_SIZE(deque) >> 1;
PyObject *tmp;
- while (n-- > 0) {
+ n++;
+ while (--n) {
/* Validate that pointers haven't met in the middle */
assert(leftblock != rightblock || leftindex < rightindex);
CHECK_NOT_END(leftblock);
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list