diff options
author | Raymond Hettinger <python@rcn.com> | 2016-01-24 20:40:42 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-01-24 20:40:42 (GMT) |
commit | 306d6b1ea6bf2582b9284be2fd27275abbade3e1 (patch) | |
tree | cf6ab783eb4b168e27a51e5a3f6136526061fa82 /Modules/_collectionsmodule.c | |
parent | 165eee214bc388eb588db33385ca49ddbb305565 (diff) | |
download | cpython-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.c | 3 |
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); |