Returns the sum of a and b unless it would overflow or underflow in which case Integer.MAX_VALUE or Integer.MIN_VALUE is returned, respectively. @since 20.0
(int a, int b)
| 557 | */ |
| 558 | |
| 559 | @Beta |
| 560 | public static int saturatedAdd(int a, int b) { |
| 561 | return Ints.saturatedCast((long) a + b); |
| 562 | } |
| 563 | |
| 564 | /** |
| 565 | * Returns the difference of {@code a} and {@code b} unless it would overflow or underflow in |
no test coverage detected