MCPcopy Index your code
hub / github.com/antlr/codebuff / hashCode

Method hashCode

output/java_guava/1.4.17/HashCode.java:403–419  ·  view source on GitHub ↗

Returns a "Java hash code" for this HashCode instance; this is well-defined (so, for example, you can safely put HashCode instances into a HashSet) but is otherwise probably not what you want to use.

()

Source from the content-addressed store, hash-verified

401 */
402
403 @Override
404 public final int hashCode() {
405 // If we have at least 4 bytes (32 bits), just take the first 4 bytes. Since this is
406 // already a (presumably) high-quality hash code, any four bytes of it will do.
407 if (bits() >= 32) {
408 return asInt();
409 }
410 // If we have less than 4 bytes, use them all.
411
412
413 byte[] bytes = getBytesInternal();
414 int val = (bytes[0] & 0xFF);
415 for (int i = 1; i < bytes.length; i++) {
416 val |= ((bytes[i] & 0xFF) << (i * 8));
417 }
418 return val;
419 }
420
421 /**
422 * Returns a string containing each byte of {@link #asBytes}, in order, as a two-digit unsigned

Callers

nothing calls this directly

Calls 3

bitsMethod · 0.95
asIntMethod · 0.95
getBytesInternalMethod · 0.95

Tested by

no test coverage detected