From: Robert Bradshaw Date: Sat, 7 Feb 2009 00:43:03 +0000 (-0800) Subject: Optimize None -> bool to avoid branching X-Git-Tag: 0.11.rc~92 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9889fe7b77e77d7c408e785bdb2a15c3bcdb4465;p=cython.git Optimize None -> bool to avoid branching --- diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py index 8a024f03..7f11935c 100644 --- a/Cython/Compiler/PyrexTypes.py +++ b/Cython/Compiler/PyrexTypes.py @@ -1398,8 +1398,7 @@ static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; - else if (x == Py_False) return 0; - else if (x == Py_None) return 0; + else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); }