package n;

import x4.AbstractC3250p;

/* JADX INFO: renamed from: n.g, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2580g {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int[] f21436a;

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

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

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

    public C2580g() {
        int iHighestOneBit = Integer.bitCount(8) != 1 ? Integer.highestOneBit(7) << 1 : 8;
        this.f21439d = iHighestOneBit - 1;
        this.f21436a = new int[iHighestOneBit];
    }

    public final void a(int i6) {
        int[] iArr = this.f21436a;
        int i7 = this.f21438c;
        iArr[i7] = i6;
        int i8 = this.f21439d & (i7 + 1);
        this.f21438c = i8;
        int i9 = this.f21437b;
        if (i8 == i9) {
            int length = iArr.length;
            int i10 = length - i9;
            int i11 = length << 1;
            if (i11 < 0) {
                throw new RuntimeException("Max array capacity exceeded");
            }
            int[] iArr2 = new int[i11];
            AbstractC3250p.x(0, i9, length, iArr, iArr2);
            AbstractC3250p.x(i10, 0, this.f21437b, this.f21436a, iArr2);
            this.f21436a = iArr2;
            this.f21437b = 0;
            this.f21438c = length;
            this.f21439d = i11 - 1;
        }
    }

    public final int b(int i6) {
        if (i6 < 0 || i6 >= c()) {
            throw new ArrayIndexOutOfBoundsException();
        }
        return this.f21436a[this.f21439d & (this.f21437b + i6)];
    }

    public final int c() {
        return (this.f21438c - this.f21437b) & this.f21439d;
    }
}
