Commit 6bfd88fd authored by Stefan Behnel's avatar Stefan Behnel

Avoid "possible loss of data" warning in MSVC by adding redundant casts to...

Avoid "possible loss of data" warning in MSVC by adding redundant casts to code that gets discarded later.
parent 100a53ff
......@@ -265,24 +265,24 @@ static CYTHON_INLINE {{TYPE}} __Pyx_{{BINOP}}_{{NAME}}_checking_overflow({{TYPE}
return __Pyx_{{BINOP}}_no_overflow(a, b, overflow);
} else if (__PYX_IS_UNSIGNED({{TYPE}})) {
if ((sizeof({{TYPE}}) == sizeof(unsigned int))) {
return __Pyx_{{BINOP}}_unsigned_int_checking_overflow(a, b, overflow);
return ({{TYPE}}) __Pyx_{{BINOP}}_unsigned_int_checking_overflow(a, b, overflow);
} else if ((sizeof({{TYPE}}) == sizeof(unsigned long))) {
return __Pyx_{{BINOP}}_unsigned_long_checking_overflow(a, b, overflow);
return ({{TYPE}}) __Pyx_{{BINOP}}_unsigned_long_checking_overflow(a, b, overflow);
#ifdef HAVE_LONG_LONG
} else if ((sizeof({{TYPE}}) == sizeof(unsigned PY_LONG_LONG))) {
return __Pyx_{{BINOP}}_unsigned_long_long_checking_overflow(a, b, overflow);
return ({{TYPE}}) __Pyx_{{BINOP}}_unsigned_long_long_checking_overflow(a, b, overflow);
#endif
} else {
abort(); return 0; /* handled elsewhere */
}
} else {
if ((sizeof({{TYPE}}) == sizeof(int))) {
return __Pyx_{{BINOP}}_int_checking_overflow(a, b, overflow);
return ({{TYPE}}) __Pyx_{{BINOP}}_int_checking_overflow(a, b, overflow);
} else if ((sizeof({{TYPE}}) == sizeof(long))) {
return __Pyx_{{BINOP}}_long_checking_overflow(a, b, overflow);
return ({{TYPE}}) __Pyx_{{BINOP}}_long_checking_overflow(a, b, overflow);
#ifdef HAVE_LONG_LONG
} else if ((sizeof({{TYPE}}) == sizeof(PY_LONG_LONG))) {
return __Pyx_{{BINOP}}_long_long_checking_overflow(a, b, overflow);
return ({{TYPE}}) __Pyx_{{BINOP}}_long_long_checking_overflow(a, b, overflow);
#endif
} else {
abort(); return 0; /* handled elsewhere */
......
......@@ -423,7 +423,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
return __Pyx_PyIndex_AsSsize_t(o);
return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
#if PY_MAJOR_VERSION < 3
} else if (likely(PyInt_CheckExact(o))) {
return PyInt_AS_LONG(o);
......
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