summaryrefslogtreecommitdiffstats
path: root/Modules/_collectionsmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-02-28 15:41:30 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-02-28 15:41:30 (GMT)
commit63d1ff2a0b5d6d1287472dcc18ed83569f7c1096 (patch)
tree8a7fb2b221ed4d57c4d944cd1e145c2e68428813 /Modules/_collectionsmodule.c
parent6ab0ec935260247640fd963f29e446238fb436bd (diff)
downloadcpython-63d1ff2a0b5d6d1287472dcc18ed83569f7c1096.zip
cpython-63d1ff2a0b5d6d1287472dcc18ed83569f7c1096.tar.gz
cpython-63d1ff2a0b5d6d1287472dcc18ed83569f7c1096.tar.bz2
Convert one more division to unsigned arithmetic to speed-up deque_item().
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r--Modules/_collectionsmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 8494a47..d12f0e876 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -788,7 +788,9 @@ deque_item(dequeobject *deque, Py_ssize_t i)
while (n--)
b = b->rightlink;
} else {
- n = (deque->leftindex + Py_SIZE(deque) - 1) / BLOCKLEN - n;
+ n = (Py_ssize_t)(
+ ((unsigned)(deque->leftindex + Py_SIZE(deque) - 1))
+ / BLOCKLEN - n);
b = deque->rightblock;
while (n--)
b = b->leftlink;