MCPcopy Create free account
hub / github.com/numpy/numpy / safe_sub

Function safe_sub

numpy/core/src/common/npy_extint128.h:26–36  ·  view source on GitHub ↗

Integer subtraction with overflow checking */

Source from the content-addressed store, hash-verified

24
25/* Integer subtraction with overflow checking */
26static inline npy_int64
27safe_sub(npy_int64 a, npy_int64 b, char *overflow_flag)
28{
29 if (a >= 0 && b < a - NPY_MAX_INT64) {
30 *overflow_flag = 1;
31 }
32 else if (a < 0 && b > a - NPY_MIN_INT64) {
33 *overflow_flag = 1;
34 }
35 return a - b;
36}
37
38
39/* Integer multiplication with overflow checking */

Callers 1

diophantine_dfsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected