MCPcopy Create free account
hub / github.com/antlr/codebuff / saturatedAdd

Method saturatedAdd

corpus/java/training/guava/math/IntMath.java:534–537  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

532 * @since 20.0
533 */
534 @Beta
535 public static int saturatedAdd(int a, int b) {
536 return Ints.saturatedCast((long) a + b);
537 }
538
539 /**
540 * Returns the difference of {@code a} and {@code b} unless it would overflow or underflow in

Callers 4

sizeMethod · 0.95
sizeMethod · 0.95
sizeMethod · 0.95
sizeMethod · 0.95

Calls 1

saturatedCastMethod · 0.95

Tested by

no test coverage detected