Lines Matching refs:b

109 #define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)  argument
169 #define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ argument
170 ((b) < 0 \
171 ? (a) < (min) - (b) \
172 : (max) - (b) < (a))
176 #define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ argument
177 ((b) < 0 \
178 ? (max) + (b) < (a) \
179 : (a) < (min) + (b))
192 #define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ argument
193 ((b) < 0 \
195 ? (a) < (max) / (b) \
196 : (b) == -1 \
198 : (min) / (b) < (a)) \
199 : (b) == 0 \
202 ? (a) < (min) / (b) \
203 : (max) / (b) < (a)))
207 #define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ argument
208 ((min) < 0 && (b) == -1 && (a) < - (max))
215 #define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ argument
216 INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max)
225 #define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ argument
227 ? (a) < (min) >> (b) \
228 : (max) >> (b) < (a))
269 # define _GL_ADD_OVERFLOW(a, b, min, max) \ argument
270 __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
271 # define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ argument
272 __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0)
273 # define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ argument
274 __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0)
276 # define _GL_ADD_OVERFLOW(a, b, min, max) \ argument
277 ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \
278 : (a) < 0 ? (b) <= (a) + (b) \
279 : (b) < 0 ? (a) <= (a) + (b) \
280 : (a) + (b) < (b))
281 # define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ argument
282 ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \
284 : (b) < 0 ? (a) - (b) <= (a) \
285 : (a) < (b))
286 # define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ argument
287 (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \
288 || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
290 #define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ argument
291 ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
292 : (a) < 0 ? (b) <= (a) + (b) - 1 \
293 : (b) < 0 && (a) + (b) <= (a))
294 #define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ argument
295 ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \
296 : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \
297 : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
303 #define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ argument
304 (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \
305 ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \
307 : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \
308 : (a) % - (b)) \
360 #define INT_ADD_OVERFLOW(a, b) \ argument
361 _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
362 #define INT_SUBTRACT_OVERFLOW(a, b) \ argument
363 _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
370 #define INT_MULTIPLY_OVERFLOW(a, b) \ argument
371 _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
372 #define INT_DIVIDE_OVERFLOW(a, b) \ argument
373 _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW)
374 #define INT_REMAINDER_OVERFLOW(a, b) \ argument
375 _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW)
376 #define INT_LEFT_SHIFT_OVERFLOW(a, b) \ argument
377 INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \
384 #define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ argument
385 op_result_overflow (a, b, \
386 _GL_INT_MINIMUM (_GL_INT_CONVERT (a, b)), \
387 _GL_INT_MAXIMUM (_GL_INT_CONVERT (a, b)))
392 # define INT_ADD_WRAPV(a, b, r) __builtin_add_overflow (a, b, r) argument
393 # define INT_SUBTRACT_WRAPV(a, b, r) __builtin_sub_overflow (a, b, r) argument
395 # define INT_ADD_WRAPV(a, b, r) \ argument
396 _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW)
397 # define INT_SUBTRACT_WRAPV(a, b, r) \ argument
398 _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
404 # define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) argument
407 # define INT_MULTIPLY_WRAPV(a, b, r) \ argument
408 ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \
409 && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \
410 ? ((void) __builtin_mul_overflow (a, b, r), 1) \
411 : __builtin_mul_overflow (a, b, r))
414 # define INT_MULTIPLY_WRAPV(a, b, r) \ argument
415 _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
434 # define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ argument
438 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
441 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
444 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
447 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
450 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
453 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
456 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
459 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
462 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
465 _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
474 # define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ argument
476 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, st, smin, smax) \
477 : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, ut, 0, umax))
479 # define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ argument
480 (overflow (a, b, smin, smax) \
481 ? (overflow (a, b, 0, umax) \
482 ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 1) \
483 : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) < 0) \
484 : (overflow (a, b, 0, umax) \
485 ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) >= 0 \
486 : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 0)))
489 # define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ argument
491 ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \
495 ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \
500 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
502 : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
504 : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
506 # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ argument
509 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
511 : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
514 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
516 : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
519 # define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ argument
521 ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
523 : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
532 #define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ argument
533 (overflow (a, b, tmin, tmax) \
534 ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \
535 : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0))
554 #define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \ argument
555 ((t) ((ut) (a) op (ut) (b)))
561 #define _GL_INT_ADD_RANGE_OVERFLOW(a, b, tmin, tmax) \ argument
562 ((b) < 0 \
564 ? ((EXPR_SIGNED (_GL_INT_CONVERT (a, (tmin) - (b))) || (b) < (tmin)) \
565 && (a) < (tmin) - (b)) \
566 : (a) <= -1 - (b)) \
567 || ((EXPR_SIGNED (a) ? 0 <= (a) : (tmax) < (a)) && (tmax) < (a) + (b))) \
570 ? ((EXPR_SIGNED (_GL_INT_CONVERT (b, (tmin) - (a))) || (a) < (tmin)) \
571 && (b) < (tmin) - (a)) \
572 : (b) <= -1 - (a)) \
573 || ((EXPR_SIGNED (_GL_INT_CONVERT (a, b)) || (tmax) < (b)) \
574 && (tmax) < (a) + (b))) \
575 : (tmax) < (b) || (tmax) - (b) < (a))
576 #define _GL_INT_SUBTRACT_RANGE_OVERFLOW(a, b, tmin, tmax) \ argument
577 (((a) < 0) == ((b) < 0) \
578 ? ((a) < (b) \
579 ? !(tmin) || -1 - (tmin) < (b) - (a) - 1 \
580 : (tmax) < (a) - (b)) \
582 ? ((!EXPR_SIGNED (_GL_INT_CONVERT ((a) - (tmin), b)) && (a) - (tmin) < 0) \
583 || (a) - (tmin) < (b)) \
584 : ((! (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \
585 && EXPR_SIGNED (_GL_INT_CONVERT ((tmax) + (b), a))) \
586 && (tmax) <= -1 - (b)) \
587 || (tmax) + (b) < (a)))
588 #define _GL_INT_MULTIPLY_RANGE_OVERFLOW(a, b, tmin, tmax) \ argument
589 ((b) < 0 \
591 ? (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \
592 ? (a) < (tmax) / (b) \
593 : ((INT_NEGATE_OVERFLOW (b) \
594 ? _GL_INT_CONVERT (b, tmax) >> (TYPE_WIDTH (+ (b)) - 1) \
595 : (tmax) / -(b)) \
597 : INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \
601 : (tmin) / (b) < (a)) \
602 : (b) == 0 \
606 ? (EXPR_SIGNED (b) ? 0 < (b) + (tmin) : -1 - (tmin) < (b) - 1) \
607 : (tmin) / (a) < (b)) \
608 : (tmax) / (b) < (a)))
635 #define INT_ADD_OK(a, b, r) ! INT_ADD_WRAPV (a, b, r) argument
636 #define INT_SUBTRACT_OK(a, b, r) ! INT_SUBTRACT_WRAPV (a, b, r) argument
637 #define INT_MULTIPLY_OK(a, b, r) ! INT_MULTIPLY_WRAPV (a, b, r) argument