mirror of
https://github.com/python/cpython.git
synced 2025-11-11 22:55:08 +00:00
Since the index is always non-negative, use faster unsigned division and modulo.
This commit is contained in:
parent
b44ed82b81
commit
da2850f932
1 changed files with 5 additions and 3 deletions
|
|
@ -780,7 +780,9 @@ deque_item(dequeobject *deque, Py_ssize_t i)
|
||||||
b = deque->rightblock;
|
b = deque->rightblock;
|
||||||
} else {
|
} else {
|
||||||
i += deque->leftindex;
|
i += deque->leftindex;
|
||||||
n = i / BLOCKLEN;
|
assert(i >= 0);
|
||||||
|
n = (Py_ssize_t)((unsigned) i / BLOCKLEN);
|
||||||
|
i = (Py_ssize_t)((unsigned) i % BLOCKLEN);
|
||||||
i %= BLOCKLEN;
|
i %= BLOCKLEN;
|
||||||
if (index < (Py_SIZE(deque) >> 1)) {
|
if (index < (Py_SIZE(deque) >> 1)) {
|
||||||
b = deque->leftblock;
|
b = deque->leftblock;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue