Kaydet (Commit) da2850f9 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Since the index is always non-negative, use faster unsigned division and modulo.

üst b44ed82b
......@@ -780,7 +780,9 @@ deque_item(dequeobject *deque, Py_ssize_t i)
b = deque->rightblock;
} else {
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;
if (index < (Py_SIZE(deque) >> 1)) {
b = deque->leftblock;
......
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