summaryrefslogtreecommitdiffstats
path: root/Modules/_collectionsmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2016-01-24 20:40:42 (GMT)
committerRaymond Hettinger <python@rcn.com>2016-01-24 20:40:42 (GMT)
commit306d6b1ea6bf2582b9284be2fd27275abbade3e1 (patch)
treecf6ab783eb4b168e27a51e5a3f6136526061fa82 /Modules/_collectionsmodule.c
parent165eee214bc388eb588db33385ca49ddbb305565 (diff)
downloadcpython-306d6b1ea6bf2582b9284be2fd27275abbade3e1.zip
cpython-306d6b1ea6bf2582b9284be2fd27275abbade3e1.tar.gz
cpython-306d6b1ea6bf2582b9284be2fd27275abbade3e1.tar.bz2
Convert another post-decrement while-loop to pre-decrement for consistency
and better generated code (on both GCC and CLang).
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r--Modules/_collectionsmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index cc9e4e8..b77ea65 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -895,7 +895,8 @@ deque_reverse(dequeobject *deque, PyObject *unused)
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);