From 9889fe7b77e77d7c408e785bdb2a15c3bcdb4465 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 6 Feb 2009 16:43:03 -0800 Subject: [PATCH] Optimize None -> bool to avoid branching --- Cython/Compiler/PyrexTypes.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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); } -- 2.26.2