Rabbit-R1/switch port/java/sources/com/google/common/collect/Hashing.java
2024-05-21 17:08:36 -04:00

43 lines
1.3 KiB
Java

package com.google.common.collect;
import javax.annotation.CheckForNull;
@ElementTypesAreNonnullByDefault
/* loaded from: classes3.dex */
final class Hashing {
private static final long C1 = -862048943;
private static final long C2 = 461845907;
private static final int MAX_TABLE_SIZE = 1073741824;
/* JADX INFO: Access modifiers changed from: package-private */
public static boolean needsResizing(int i, int i2, double d) {
return ((double) i) > d * ((double) i2) && i2 < 1073741824;
}
private Hashing() {
}
/* JADX INFO: Access modifiers changed from: package-private */
public static int smear(int i) {
return (int) (Integer.rotateLeft((int) (i * C1), 15) * C2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public static int smearedHash(@CheckForNull Object obj) {
return smear(obj == null ? 0 : obj.hashCode());
}
/* JADX INFO: Access modifiers changed from: package-private */
public static int closedTableSize(int i, double d) {
int max = Math.max(i, 2);
int highestOneBit = Integer.highestOneBit(max);
if (max <= ((int) (d * highestOneBit))) {
return highestOneBit;
}
int i2 = highestOneBit << 1;
if (i2 > 0) {
return i2;
}
return 1073741824;
}
}