Commit 82e0a007 authored by Stefan Behnel's avatar Stefan Behnel

Try to fix abs(long long) in MSVC by returning the negative value for the "undefined" abs(-MAX-1).

parent 2324b99c
......@@ -240,8 +240,8 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_abs_longlong(PY_LONG_LONG x) {
return (unsigned PY_LONG_LONG) llabs(x);
#elif defined (_MSC_VER)
// abs() is defined for long, but 64-bits type on MSVC is long long.
// Use MS-specific _abs64 instead.
return (unsigned PY_LONG_LONG) _abs64(x);
// Use MS-specific _abs64() instead, which returns the original (negative) value for abs(-MAX-1)
return _abs64(x);
#elif defined (__GNUC__)
// gcc or clang on 64 bit windows.
return (unsigned PY_LONG_LONG) __builtin_llabs(x);
......
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