Lines Matching +full:work +full:- +full:around
1 /* intprops.h -- properties of integer types
3 Copyright (C) 2001-2018 Free Software Foundation, Inc.
28 /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
29 <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00406.html>. */
30 #define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v))
32 /* The extra casts in the following macros work around compiler bugs,
40 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
50 Padding bits are not supported; this is checked at compile-time below. */
57 ? (t) -1 \
58 : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1)))
71 (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1)
73 /* Work around OpenVMS incompatibility with C99. */
82 This assumption is tested by the intprops-tests module. */
84 /* Does the __typeof__ keyword work? This could be done by
116 (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \
129 implementation-defined behavior. Their implementations are simple
162 ? (a) < (min) - (b) \
163 : (max) - (b) < (a))
165 /* Return 1 if A - B would overflow in [MIN,MAX] arithmetic.
172 /* Return 1 if - A would overflow in [MIN,MAX] arithmetic.
176 ? (a) < - (max) \
182 <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00401.html>. */
187 : (b) == -1 \
199 ((min) < 0 && (b) == -1 && (a) < - (max))
203 Mathematically, % should never overflow, but on x86-like hosts
204 INT_MIN % -1 traps, and the C standard permits this, so treat this
214 implementation-defined behavior, but do not check these other
221 /* True if __builtin_add_overflow (A, B, P) works when P is non-null. */
239 __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
251 : (b) < 0 ? (a) - (b) <= (a) \
258 ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
259 : (a) < 0 ? (b) <= (a) + (b) - 1 \
262 ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
263 : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \
269 -B == 0) suffices, but things get tricky if -B would overflow. */
271 (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \
275 : (a) % - (b)) \
282 The INT_<op>_WRAPV macros also store the low-order bits of the answer.
283 These macros work correctly on all known practical hosts, and do not rely
310 +, binary -, and *. The result type must be signed.
314 Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
346 /* Store the low-order bits of A + B, A - B, A * B, respectively, into *R.
351 _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW)
358 For now, assume all versions of GCC-like compilers generate bogus
367 /* Store the low-order bits of A <op> B into *R, where OP specifies
418 /* Store the low-order bits of A <op> B into *R, where the operation
433 /* Return the low-order bits of A <op> B, where the operation is given
438 Assume that converting UT to T yields the low-order bits, as is
439 done in all known two's-complement C compilers. E.g., see:
440 https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html
443 implementation-defined result or signal for values outside T's
444 range. However, code that works around this theoretical problem
446 https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html
447 As the compiler bug is real, don't try to work around the