Convert two other post-decrement while-loops to pre-decrements for consistency

and for better code generation.
This commit is contained in:
Raymond Hettinger 2016-01-24 11:32:07 -08:00
parent d84ec225bd
commit 165eee214b
1 changed files with 4 additions and 2 deletions

View File

@ -937,7 +937,8 @@ deque_count(dequeobject *deque, PyObject *v)
PyObject *item; PyObject *item;
int cmp; int cmp;
while (n--) { n++;
while (--n) {
CHECK_NOT_END(b); CHECK_NOT_END(b);
item = b->data[index]; item = b->data[index];
cmp = PyObject_RichCompareBool(item, v, Py_EQ); cmp = PyObject_RichCompareBool(item, v, Py_EQ);
@ -974,7 +975,8 @@ deque_contains(dequeobject *deque, PyObject *v)
PyObject *item; PyObject *item;
int cmp; int cmp;
while (n--) { n++;
while (--n) {
CHECK_NOT_END(b); CHECK_NOT_END(b);
item = b->data[index]; item = b->data[index];
cmp = PyObject_RichCompareBool(item, v, Py_EQ); cmp = PyObject_RichCompareBool(item, v, Py_EQ);