From 306d6b1ea6bf2582b9284be2fd27275abbade3e1 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 24 Jan 2016 12:40:42 -0800 Subject: [PATCH] Convert another post-decrement while-loop to pre-decrement for consistency and better generated code (on both GCC and CLang). --- Modules/_collectionsmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index cc9e4e890ed..b77ea652fbd 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);