diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-04 07:47:48 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-06-04 07:47:48 +0200 |
commit | dc0649f7753d6b318b11805b599ea83be59ea3b4 (patch) | |
tree | 7794cd88fe035cb13738139e5d227c4864d0a086 | |
parent | 8c94bfdfc7040d37814dd8bfa9dbc38cd44beacb (diff) | |
download | cython-dc0649f7753d6b318b11805b599ea83be59ea3b4.tar.gz |
Make overflow checking code C89 again.
-rw-r--r-- | Cython/Utility/Overflow.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Cython/Utility/Overflow.c b/Cython/Utility/Overflow.c index bffc50b61..1bb63ae59 100644 --- a/Cython/Utility/Overflow.c +++ b/Cython/Utility/Overflow.c @@ -158,13 +158,14 @@ static CYTHON_INLINE {{UINT}} __Pyx_mul_const_{{NAME}}_checking_overflow({{UINT} // note that deliberately the overflow check is written such that it divides by b; this // function is used when b is a constant thus the compiler should be able to eliminate the // (very slow on most CPUs!) division operation + {{UINT}} prod; if (__Pyx_is_constant(a) && !__Pyx_is_constant(b)) { // if a is a compile-time constant and b isn't, swap them {{UINT}} temp = b; b = a; a = temp; } - {{UINT}} prod = a * b; + prod = a * b; if (b != 0) *overflow |= a > (__PYX_MAX({{UINT}}) / b); return prod; |