diff options
author | Raymond Hettinger <python@rcn.com> | 2015-09-24 02:15:44 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2015-09-24 02:15:44 (GMT) |
commit | 2b0d646b751e6e5bdb466c05ffd2824dd46c7d60 (patch) | |
tree | b7329994744aa140885f8bfa11cb0109c0aacadf /Modules/_collectionsmodule.c | |
parent | e39b57b41a384e503e2b2ce881e0f1447a6238cc (diff) | |
download | cpython-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.c | 5 |
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, |