From d53d401ef5201333fd30799d813ceeb895ba8571 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Mon, 10 May 2010 13:22:13 -0300 Subject: [PATCH] change & to && in many places --- Cython/Compiler/ExprNodes.py | 18 +++++++++--------- Cython/Compiler/Optimize.py | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index dbaa142c..dcb637a7 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -6748,12 +6748,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j static CYTHON_INLINE PyObject *__Pyx_GetItemInt_%(type)s_Fast(PyObject *o, Py_ssize_t i) { if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < Py%(type)s_GET_SIZE(o)))) { + if (likely((0 <= i) && (i < Py%(type)s_GET_SIZE(o)))) { PyObject *r = Py%(type)s_GET_ITEM(o, i); Py_INCREF(r); return r; } - else if ((-Py%(type)s_GET_SIZE(o) <= i) & (i < 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) + i); Py_INCREF(r); return r; @@ -6770,11 +6770,11 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_%(type)s_Fast(PyObject *o, Py_ss static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + if (PyList_CheckExact(o) && ((0 <= i) && (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + else if (PyTuple_CheckExact(o) && ((0 <= i) && (i < PyTuple_GET_SIZE(o)))) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } @@ -6809,7 +6809,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb } static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + if (PyList_CheckExact(o) && ((0 <= i) && (i < PyList_GET_SIZE(o)))) { Py_INCREF(v); Py_DECREF(PyList_GET_ITEM(o, i)); PyList_SET_ITEM(o, i, v); @@ -7005,7 +7005,7 @@ impl=""" static CYTHON_INLINE %(type)s __Pyx_div_%(type_name)s(%(type)s a, %(type)s b) { %(type)s q = a / b; %(type)s r = a - q*b; - q -= ((r != 0) & ((r ^ b) < 0)); + q -= ((r != 0) && ((r ^ b) < 0)); return q; } """) @@ -7017,7 +7017,7 @@ static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s, %(type)s); /* pr impl=""" static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s a, %(type)s b) { %(type)s r = a %% b; - r += ((r != 0) & ((r ^ b) < 0)) * b; + r += ((r != 0) && ((r ^ b) < 0)) * b; return r; } """) @@ -7029,7 +7029,7 @@ static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s, %(type)s); /* pr impl=""" static CYTHON_INLINE %(type)s __Pyx_mod_%(type_name)s(%(type)s a, %(type)s b) { %(type)s r = fmod%(math_h_modifier)s(a, b); - r += ((r != 0) & ((r < 0) ^ (b < 0))) * b; + r += ((r != 0) && ((r < 0) ^ (b < 0))) * b; return r; } """) @@ -7056,5 +7056,5 @@ static int __Pyx_cdivision_warning(void) { division_overflow_test_code = UtilityCode( proto=""" #define UNARY_NEG_WOULD_OVERFLOW(x) \ - (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + (((x) < 0) && ((unsigned long)(x) == 0-(unsigned long)(x))) """) diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 35ae0ac5..367c9c10 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -2425,7 +2425,7 @@ impl = """ static CYTHON_INLINE Py_UNICODE __Pyx_PyUnicode_GetItemInt(PyObject* unicode, Py_ssize_t index, int check_bounds) { if (check_bounds) { if (unlikely(index >= PyUnicode_GET_SIZE(unicode)) | - ((index < 0) & unlikely(index < -PyUnicode_GET_SIZE(unicode)))) { + ((index < 0) && unlikely(index < -PyUnicode_GET_SIZE(unicode)))) { PyErr_Format(PyExc_IndexError, "string index out of range"); return (Py_UNICODE)-1; } @@ -2446,7 +2446,7 @@ impl = """ static CYTHON_INLINE char __Pyx_PyBytes_GetItemInt(PyObject* bytes, Py_ssize_t index, int check_bounds) { if (check_bounds) { if (unlikely(index >= PyBytes_GET_SIZE(bytes)) | - ((index < 0) & unlikely(index < -PyBytes_GET_SIZE(bytes)))) { + ((index < 0) && unlikely(index < -PyBytes_GET_SIZE(bytes)))) { PyErr_Format(PyExc_IndexError, "string index out of range"); return -1; } -- 2.26.2