Commit 840533bf authored by Raymond Hettinger's avatar Raymond Hettinger

Use a do-while loop in the inner loop for rotate (m is always greater than zero).

parent 3959af9b
......@@ -506,13 +506,15 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
rightindex -= m;
leftindex -= m;
n -= m;
while (m--)
do {
*(dest--) = *(src--);
} while (--m);
}
if (rightindex == -1) {
block *prevblock = rightblock->leftlink;
assert(leftblock != rightblock);
assert(b == NULL);
b = rightblock;
CHECK_NOT_END(prevblock);
MARK_END(prevblock->rightlink);
......@@ -551,13 +553,15 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
leftindex += m;
rightindex += m;
n += m;
while (m--)
do {
*(dest++) = *(src++);
} while (--m);
}
if (leftindex == BLOCKLEN) {
block *nextblock = leftblock->rightlink;
assert(leftblock != rightblock);
assert(b == NULL);
b = leftblock;
CHECK_NOT_END(nextblock);
MARK_END(nextblock->leftlink);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment