diff options
author | João Valverde <j@v6e.pt> | 2022-03-31 15:36:07 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2022-03-31 15:49:43 +0100 |
commit | e15658d1c07fabeacea7c358b853eab4ad3af818 (patch) | |
tree | 56aad4f943c1db33eec4d55b7319392c687077b2 /wsutil | |
parent | 85aa5939f1c53d8c842756cc5974e2380f365fcd (diff) |
safe-math: Fix non-existent built-ins
Divison and modulo are not built-ins implemented by GCC or Clang.
Replace the spurious macro definition with the internal implementation.
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/safe-math.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/wsutil/safe-math.h b/wsutil/safe-math.h index d67a985345..e1814941c5 100644 --- a/wsutil/safe-math.h +++ b/wsutil/safe-math.h @@ -1027,8 +1027,8 @@ PSNIP_SAFE_DEFINE_UNSIGNED_MOD(psnip_uint64_t, uint64, 0xffffffffffffffffULL) #define psnip_safe_add(res, a, b) !__builtin_add_overflow(a, b, res) #define psnip_safe_sub(res, a, b) !__builtin_sub_overflow(a, b, res) #define psnip_safe_mul(res, a, b) !__builtin_mul_overflow(a, b, res) -#define psnip_safe_div(res, a, b) !__builtin_div_overflow(a, b, res) -#define psnip_safe_mod(res, a, b) !__builtin_mod_overflow(a, b, res) +#define psnip_safe_div(res, a, b) PSNIP_SAFE_C11_GENERIC_BINARY_OP(div, res, a, b) +#define psnip_safe_mod(res, a, b) PSNIP_SAFE_C11_GENERIC_BINARY_OP(mod, res, a, b) #define psnip_safe_neg(res, v) PSNIP_SAFE_C11_GENERIC_UNARY_OP (neg, res, v) #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) |