public static int combineHashCodes(final Object o1, final Object o2) { return combineHashCodes( o1 == null ? NullHashCode : hashCode(o1), o2 == null ? NullHashCode : hashCode(o2) ); }
public static int expandPrime(final int oldSize) { final int newSize = 2 * oldSize; // Allow the hashtables to grow to maximum possible size (~2G elements) before encoutering capacity overflow. // Note that this check works even when _items.Length overflowed thanks to the (uint) cast if (Math.abs(newSize) > MaxPrimeArrayLength && MaxPrimeArrayLength > oldSize) { assert MaxPrimeArrayLength == getPrime(MaxPrimeArrayLength) : "Invalid MaxPrimeArrayLength"; return MaxPrimeArrayLength; } return getPrime(newSize); } }
public void set( final Tag tag, final int refIndex1, final ReferenceKind refKind) { _tag = tag; _refIndex1 = refIndex1; _refIndex2 = refKind.tag; _hashCode = HashUtilities.combineHashCodes(tag, refIndex1); }
public static int hashItems(final Iterable<?> items) { int hash = 0; for (final Object o : items) { hash <<= CombinedHashOffset; hash ^= hashCode(o); } return hash; }
public static int getPrime(final int min) { VerifyArgument.isNonNegative(min, "min"); for (final int prime : Primes) { if (prime >= min) { return prime; } } //outside of our predefined table. //compute the hard way. for (int i = (min | 1); i < Integer.MAX_VALUE; i += 2) { if (isPrime(i) && ((i - 1) % HashPrime != 0)) { return i; } } return min; }
public void set( final Tag tag, final int refIndex1, final int refIndex2) { _tag = tag; _refIndex1 = refIndex1; _refIndex2 = refIndex2; _hashCode = HashUtilities.combineHashCodes(tag, refIndex1, refIndex2); }
@Override public int hashCode() { return HashUtilities.hashCode(_typeVariable); }
public static int getPrime(final int min) { VerifyArgument.isNonNegative(min, "min"); for (final int prime : Primes) { if (prime >= min) { return prime; } } //outside of our predefined table. //compute the hard way. for (int i = (min | 1); i < Integer.MAX_VALUE; i += 2) { if (isPrime(i) && ((i - 1) % HashPrime != 0)) { return i; } } return min; }
public static int combineHashCodes(final Object o1, final Object o2, final Object o3, final Object o4) { return combineHashCodes( o1 == null ? NullHashCode : hashCode(o1), o2 == null ? NullHashCode : hashCode(o2), o3 == null ? NullHashCode : hashCode(o3), o4 == null ? NullHashCode : hashCode(o4) ); }
public void set( final Tag tag, final int refIndex1, final ReferenceKind refKind) { _tag = tag; _refIndex1 = refIndex1; _refIndex2 = refKind.tag; _hashCode = HashUtilities.combineHashCodes(tag, refIndex1); }
@Override public Integer visitPrimitiveType(final Type<?> type, final Void parameter) { return HashUtilities.hashCode(type.getKind()); }
public static int expandPrime(final int oldSize) { final int newSize = 2 * oldSize; // Allow the hashtables to grow to maximum possible size (~2G elements) before encoutering capacity overflow. // Note that this check works even when _items.Length overflowed thanks to the (uint) cast if (Math.abs(newSize) > MaxPrimeArrayLength && MaxPrimeArrayLength > oldSize) { assert MaxPrimeArrayLength == getPrime(MaxPrimeArrayLength) : "Invalid MaxPrimeArrayLength"; return MaxPrimeArrayLength; } return getPrime(newSize); } }
public static int getPrime(final int min) { VerifyArgument.isNonNegative(min, "min"); for (final int prime : Primes) { if (prime >= min) { return prime; } } //outside of our predefined table. //compute the hard way. for (int i = (min | 1); i < Integer.MAX_VALUE; i += 2) { if (isPrime(i) && ((i - 1) % HashPrime != 0)) { return i; } } return min; }
public static int combineHashCodes(final Object o1, final Object o2, final Object o3) { return combineHashCodes( o1 == null ? NullHashCode : hashCode(o1), o2 == null ? NullHashCode : hashCode(o2), o3 == null ? NullHashCode : hashCode(o3) ); }
public void set(final String utf8Value) { _tag = Tag.Utf8StringConstant; _stringValue1 = utf8Value; _hashCode = HashUtilities.combineHashCodes(_tag, utf8Value); }
@Override public int hashCode() { return HashUtilities.hashCode(getFullName()); }
public static int expandPrime(final int oldSize) { final int newSize = 2 * oldSize; // Allow the hashtables to grow to maximum possible size (~2G elements) before encoutering capacity overflow. // Note that this check works even when _items.Length overflowed thanks to the (uint) cast if (Math.abs(newSize) > MaxPrimeArrayLength && MaxPrimeArrayLength > oldSize) { assert MaxPrimeArrayLength == getPrime(MaxPrimeArrayLength) : "Invalid MaxPrimeArrayLength"; return MaxPrimeArrayLength; } return getPrime(newSize); } }
public static int combineHashCodes(final Object o1, final Object o2, final Object o3) { return combineHashCodes( o1 == null ? NullHashCode : hashCode(o1), o2 == null ? NullHashCode : hashCode(o2), o3 == null ? NullHashCode : hashCode(o3) ); }
public void set( final Tag tag, final int refIndex1, final int refIndex2) { _tag = tag; _refIndex1 = refIndex1; _refIndex2 = refIndex2; _hashCode = HashUtilities.combineHashCodes(tag, refIndex1, refIndex2); }
@Override public int hashCode() { return HashUtilities.hashCode(getFullName()); }