Commit 1e0af779 authored by Robert Bradshaw's avatar Robert Bradshaw

Optimize negative indexing.

parent 8145cba6
...@@ -5418,8 +5418,8 @@ static INLINE PyObject *__Pyx_GetItemInt_%(type)s(PyObject *o, Py_ssize_t i, int ...@@ -5418,8 +5418,8 @@ static INLINE PyObject *__Pyx_GetItemInt_%(type)s(PyObject *o, Py_ssize_t i, int
Py_INCREF(r); Py_INCREF(r);
return r; return r;
} }
else if ((i == -1) & likely(Py%(type)s_GET_SIZE(o) > 0)) { else if ((-Py%(type)s_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = Py%(type)s_GET_ITEM(o, Py%(type)s_GET_SIZE(o) - 1); PyObject *r = Py%(type)s_GET_ITEM(o, Py%(type)s_GET_SIZE(o) + i);
Py_INCREF(r); Py_INCREF(r);
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment