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

Method saturatedCast

output/java_guava/1.4.18/Ints.java:111–119  ·  view source on GitHub ↗

Returns the int nearest in value to value. @param value any long value @return the same value cast to int if it is in the range of the int type, Integer#MAX_VALUE if it is too large, or Integer#MIN_VALUE if it is too small

(long value)

Source from the content-addressed store, hash-verified

109
110
111 public static int saturatedCast(long value) {
112 if (value > Integer.MAX_VALUE) {
113 return Integer.MAX_VALUE;
114 }
115 if (value < Integer.MIN_VALUE) {
116 return Integer.MIN_VALUE;
117 }
118 return (int) value;
119 }
120
121 /**
122 * Compares the two specified {@code int} values. The sign of the value returned is the same as

Callers 15

sizeMethod · 0.95
sizeMethod · 0.95
sizeMethod · 0.95
saturatedAddMethod · 0.95
saturatedSubtractMethod · 0.95
saturatedMultiplyMethod · 0.95
sizeMethod · 0.95
distinctElementsMethod · 0.95
sizeImplMethod · 0.95
sizeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected