mirror of https://github.com/python/cpython
Optimization guides suggest copying memory in an ascending direction when possible.
This commit is contained in:
parent
5d0bb852a2
commit
0e259f18f7
|
@ -534,13 +534,13 @@ _deque_rotate(dequeobject *deque, Py_ssize_t n)
|
|||
if (m > leftindex)
|
||||
m = leftindex;
|
||||
assert (m > 0 && m <= len);
|
||||
src = &rightblock->data[rightindex];
|
||||
dest = &leftblock->data[leftindex - 1];
|
||||
rightindex -= m;
|
||||
leftindex -= m;
|
||||
src = &rightblock->data[rightindex + 1];
|
||||
dest = &leftblock->data[leftindex];
|
||||
n -= m;
|
||||
do {
|
||||
*(dest--) = *(src--);
|
||||
*(dest++) = *(src++);
|
||||
} while (--m);
|
||||
}
|
||||
if (rightindex == -1) {
|
||||
|
|
Loading…
Reference in New Issue