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

Method overflowInParse

output/java_guava/1.4.17/UnsignedLongs.java:348–362  ·  view source on GitHub ↗

Returns true if (current radix) + digit is a number too large to be represented by an unsigned long. This is useful for detecting overflow while parsing a string representation of a number. Does not verify whether supplied radix is valid, passing an invalid radix will give undefined results or an Ar

(long current, int digit, int radix)

Source from the content-addressed store, hash-verified

346 */
347
348 private static boolean overflowInParse(long current, int digit, int radix) {
349 if (current >= 0) {
350 if (current < maxValueDivs[radix]) {
351 return false;
352 }
353 if (current > maxValueDivs[radix]) {
354 return true;
355 }
356 // current == maxValueDivs[radix]
357 return (digit > maxValueMods[radix]);
358 }
359
360 // current < 0: high bit is set
361 return true;
362 }
363
364 /**
365 * Returns a string representation of x, where x is treated as unsigned.

Callers 1

parseUnsignedLongMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected