summaryrefslogtreecommitdiffstats
path: root/Modules/_collectionsmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-09-24 02:15:44 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-09-24 02:15:44 (GMT)
commit2b0d646b751e6e5bdb466c05ffd2824dd46c7d60 (patch)
treeb7329994744aa140885f8bfa11cb0109c0aacadf /Modules/_collectionsmodule.c
parente39b57b41a384e503e2b2ce881e0f1447a6238cc (diff)
downloadcpython-2b0d646b751e6e5bdb466c05ffd2824dd46c7d60.zip
cpython-2b0d646b751e6e5bdb466c05ffd2824dd46c7d60.tar.gz
cpython-2b0d646b751e6e5bdb466c05ffd2824dd46c7d60.tar.bz2
Replace an unpredictable branch with a simple addition.
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r--Modules/_collectionsmodule.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index be6c90c..8d753c3 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -852,10 +852,9 @@ deque_count(dequeobject *deque, PyObject *v)
CHECK_NOT_END(b);
item = b->data[index];
cmp = PyObject_RichCompareBool(item, v, Py_EQ);
- if (cmp > 0)
- count++;
- else if (cmp < 0)
+ if (cmp < 0)
return NULL;
+ count += cmp;
if (start_state != deque->state) {
PyErr_SetString(PyExc_RuntimeError,