package f.a.w.h;

/* JADX INFO: compiled from: OpenHashSet.java */
/* JADX INFO: loaded from: classes.dex */
public final class e<T> {
    public int a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f4040b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f4041c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public T[] f4042d;

    public e() {
        int iF = d.i.c.a.F(16);
        this.a = iF - 1;
        this.f4041c = (int) (iF * 0.75f);
        this.f4042d = (T[]) new Object[iF];
    }

    public static int b(int i2) {
        int i3 = i2 * (-1640531527);
        return i3 ^ (i3 >>> 16);
    }

    public boolean a(T t) {
        T t2;
        T[] tArr = this.f4042d;
        int i2 = this.a;
        int iB = b(t.hashCode()) & i2;
        T t3 = tArr[iB];
        if (t3 != null) {
            if (t3.equals(t)) {
                return false;
            }
            do {
                iB = (iB + 1) & i2;
                t2 = tArr[iB];
                if (t2 == null) {
                }
            } while (!t2.equals(t));
            return false;
        }
        tArr[iB] = t;
        int i3 = this.f4040b + 1;
        this.f4040b = i3;
        if (i3 >= this.f4041c) {
            T[] tArr2 = this.f4042d;
            int length = tArr2.length;
            int i4 = length << 1;
            int i5 = i4 - 1;
            T[] tArr3 = (T[]) new Object[i4];
            while (true) {
                int i6 = i3 - 1;
                if (i3 == 0) {
                    break;
                }
                do {
                    length--;
                } while (tArr2[length] == null);
                int iB2 = b(tArr2[length].hashCode()) & i5;
                if (tArr3[iB2] != null) {
                    do {
                        iB2 = (iB2 + 1) & i5;
                    } while (tArr3[iB2] != null);
                }
                tArr3[iB2] = tArr2[length];
                i3 = i6;
            }
            this.a = i5;
            this.f4041c = (int) (i4 * 0.75f);
            this.f4042d = tArr3;
        }
        return true;
    }

    public boolean c(int i2, T[] tArr, int i3) {
        int i4;
        T t;
        this.f4040b--;
        while (true) {
            int i5 = i2 + 1;
            while (true) {
                i4 = i5 & i3;
                t = tArr[i4];
                if (t == null) {
                    tArr[i2] = null;
                    return true;
                }
                int iB = b(t.hashCode()) & i3;
                if (i2 <= i4) {
                    if (i2 >= iB || iB > i4) {
                        break;
                    }
                    i5 = i4 + 1;
                } else if (i2 < iB || iB <= i4) {
                    i5 = i4 + 1;
                }
            }
            tArr[i2] = t;
            i2 = i4;
        }
    }
}
