Replace an unpredictable branch with a simple addition.
This commit is contained in:
parent
e39b57b41a
commit
2b0d646b75
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue