package kotlinx.coroutines.internal;

import p009c1.C0498c;

/* renamed from: kotlinx.coroutines.internal.a */
/* loaded from: classes.dex */
public class C1351a<T> {

    /* renamed from: a */
    public Object[] f3009a = new Object[16];

    /* renamed from: b */
    public int f3010b;

    /* renamed from: c */
    public int f3011c;

    /* renamed from: a */
    public final void m1575a(T t) {
        Object[] objArr = this.f3009a;
        int i = this.f3011c;
        objArr[i] = t;
        int length = (objArr.length - 1) & (i + 1);
        this.f3011c = length;
        if (length == this.f3010b) {
            m1574b();
        }
    }

    /* renamed from: b */
    public final void m1574b() {
        Object[] objArr = this.f3009a;
        int length = objArr.length;
        Object[] objArr2 = new Object[length << 1];
        C0498c.m3616c(objArr, objArr2, 0, this.f3010b, 0, 10, null);
        Object[] objArr3 = this.f3009a;
        int length2 = objArr3.length;
        int i = this.f3010b;
        C0498c.m3616c(objArr3, objArr2, length2 - i, 0, i, 4, null);
        this.f3009a = objArr2;
        this.f3010b = 0;
        this.f3011c = length;
    }

    /* renamed from: c */
    public final boolean m1573c() {
        return this.f3010b == this.f3011c;
    }

    /* renamed from: d */
    public final T m1572d() {
        int i = this.f3010b;
        if (i == this.f3011c) {
            return null;
        }
        Object[] objArr = this.f3009a;
        T t = (T) objArr[i];
        objArr[i] = null;
        this.f3010b = (i + 1) & (objArr.length - 1);
        if (t != null) {
            return t;
        }
        throw new NullPointerException("null cannot be cast to non-null type T of kotlinx.coroutines.internal.ArrayQueue");
    }
}