package p037.p057;

/* JADX INFO: renamed from: މ.ށ.ށ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C1718<E> {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public E[] f5576;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int f5577;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public int f5578;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public int f5579;

    public C1718(int i) {
        if (i < 1) {
            throw new IllegalArgumentException("capacity must be >= 1");
        }
        if (i > 1073741824) {
            throw new IllegalArgumentException("capacity must be <= 2^30");
        }
        i = Integer.bitCount(i) != 1 ? Integer.highestOneBit(i - 1) << 1 : i;
        this.f5579 = i - 1;
        this.f5576 = (E[]) new Object[i];
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m3348() {
        E[] eArr = this.f5576;
        int length = eArr.length;
        int i = this.f5577;
        int i2 = length - i;
        int i3 = length << 1;
        if (i3 < 0) {
            throw new RuntimeException("Max array capacity exceeded");
        }
        E[] eArr2 = (E[]) new Object[i3];
        System.arraycopy(eArr, i, eArr2, 0, i2);
        System.arraycopy(this.f5576, 0, eArr2, i2, this.f5577);
        this.f5576 = eArr2;
        this.f5577 = 0;
        this.f5578 = length;
        this.f5579 = i3 - 1;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3349(int i) {
        int i2;
        if (i <= 0) {
            return;
        }
        if (i > m3350()) {
            throw new ArrayIndexOutOfBoundsException();
        }
        int i3 = this.f5578;
        int i4 = i < i3 ? i3 - i : 0;
        int i5 = i4;
        while (true) {
            i2 = this.f5578;
            if (i5 >= i2) {
                break;
            }
            this.f5576[i5] = null;
            i5++;
        }
        int i6 = i2 - i4;
        int i7 = i - i6;
        this.f5578 = i2 - i6;
        if (i7 > 0) {
            int length = this.f5576.length;
            this.f5578 = length;
            int i8 = length - i7;
            for (int i9 = i8; i9 < this.f5578; i9++) {
                this.f5576[i9] = null;
            }
            this.f5578 = i8;
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int m3350() {
        return (this.f5578 - this.f5577) & this.f5579;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public void m3351(int i) {
        if (i <= 0) {
            return;
        }
        if (i > m3350()) {
            throw new ArrayIndexOutOfBoundsException();
        }
        int length = this.f5576.length;
        int i2 = this.f5577;
        if (i < length - i2) {
            length = i2 + i;
        }
        for (int i3 = this.f5577; i3 < length; i3++) {
            this.f5576[i3] = null;
        }
        int i4 = this.f5577;
        int i5 = length - i4;
        int i6 = i - i5;
        this.f5577 = this.f5579 & (i4 + i5);
        if (i6 > 0) {
            for (int i7 = 0; i7 < i6; i7++) {
                this.f5576[i7] = null;
            }
            this.f5577 = i6;
        }
    }
}
