discord-jadx/app/src/main/java/j0/l/e/f.java

107 lines
2.7 KiB
Java

package j0.l.e;
import c.q.a.k.a;
/* compiled from: OpenHashSet */
public final class f<T> {
public int a;
public int b;
/* renamed from: c reason: collision with root package name */
public int f2861c;
public T[] d;
public f() {
int N = a.N(16);
this.a = N - 1;
this.f2861c = (int) (((float) N) * 0.75f);
this.d = (T[]) new Object[N];
}
public static int b(int i) {
int i2 = i * -1640531527;
return i2 ^ (i2 >>> 16);
}
public boolean a(T t) {
T t2;
T[] tArr = this.d;
int i = this.a;
int b = b(t.hashCode()) & i;
T t3 = tArr[b];
if (t3 != null) {
if (t3.equals(t)) {
return false;
}
do {
b = (b + 1) & i;
t2 = tArr[b];
if (t2 == null) {
}
} while (!t2.equals(t));
return false;
}
tArr[b] = t;
int i2 = this.b + 1;
this.b = i2;
if (i2 >= this.f2861c) {
T[] tArr2 = this.d;
int length = tArr2.length;
int i3 = length << 1;
int i4 = i3 - 1;
T[] tArr3 = (T[]) new Object[i3];
while (true) {
int i5 = i2 - 1;
if (i2 == 0) {
break;
}
do {
length--;
} while (tArr2[length] == null);
int b2 = b(tArr2[length].hashCode()) & i4;
if (tArr3[b2] != null) {
do {
b2 = (b2 + 1) & i4;
} while (tArr3[b2] != null);
}
tArr3[b2] = tArr2[length];
i2 = i5;
}
this.a = i4;
this.f2861c = (int) (((float) i3) * 0.75f);
this.d = tArr3;
}
return true;
}
public boolean c(int i, T[] tArr, int i2) {
int i3;
T t;
this.b--;
while (true) {
int i4 = i + 1;
while (true) {
i3 = i4 & i2;
t = tArr[i3];
if (t == null) {
tArr[i] = null;
return true;
}
int b = b(t.hashCode()) & i2;
if (i <= i3) {
if (i >= b || b > i3) {
break;
}
i4 = i3 + 1;
} else {
if (i >= b && b > i3) {
break;
}
i4 = i3 + 1;
}
}
tArr[i] = t;
i = i3;
}
}
}