Integer addition with overflow checking */
| 10 | |
| 11 | /* Integer addition with overflow checking */ |
| 12 | static inline npy_int64 |
| 13 | safe_add(npy_int64 a, npy_int64 b, char *overflow_flag) |
| 14 | { |
| 15 | if (a > 0 && b > NPY_MAX_INT64 - a) { |
| 16 | *overflow_flag = 1; |
| 17 | } |
| 18 | else if (a < 0 && b < NPY_MIN_INT64 - a) { |
| 19 | *overflow_flag = 1; |
| 20 | } |
| 21 | return a + b; |
| 22 | } |
| 23 | |
| 24 | |
| 25 | /* Integer subtraction with overflow checking */ |
no outgoing calls
no test coverage detected