Replace an unpredictable branch with a simple addition.

This commit is contained in:
Raymond Hettinger 2015-09-23 19:15:44 -07:00
parent e39b57b41a
commit 2b0d646b75
1 changed files with 2 additions and 3 deletions

View File

@ -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,