package o;

import java.util.concurrent.atomic.AtomicReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.w50, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC2781w50 {
    public static final C2496t50 a = new C2496t50(new byte[0], 0, 0, false);
    public static final int b;
    public static final AtomicReference[] c;

    static {
        int iHighestOneBit = Integer.highestOneBit((Runtime.getRuntime().availableProcessors() * 2) - 1);
        b = iHighestOneBit;
        AtomicReference[] atomicReferenceArr = new AtomicReference[iHighestOneBit];
        for (int i = 0; i < iHighestOneBit; i++) {
            atomicReferenceArr[i] = new AtomicReference();
        }
        c = atomicReferenceArr;
    }

    public static final void a(C2496t50 c2496t50) {
        if (c2496t50.f != null || c2496t50.g != null) {
            throw new IllegalArgumentException("Failed requirement.");
        }
        if (c2496t50.d) {
            return;
        }
        AtomicReference atomicReference = c[(int) (Thread.currentThread().getId() & (b - 1))];
        C2496t50 c2496t502 = a;
        C2496t50 c2496t503 = (C2496t50) atomicReference.getAndSet(c2496t502);
        if (c2496t503 == c2496t502) {
            return;
        }
        int i = c2496t503 != null ? c2496t503.c : 0;
        if (i >= 65536) {
            atomicReference.set(c2496t503);
            return;
        }
        c2496t50.f = c2496t503;
        c2496t50.b = 0;
        c2496t50.c = i + 8192;
        atomicReference.set(c2496t50);
    }

    public static final C2496t50 b() {
        AtomicReference atomicReference = c[(int) (Thread.currentThread().getId() & (b - 1))];
        C2496t50 c2496t50 = a;
        C2496t50 c2496t502 = (C2496t50) atomicReference.getAndSet(c2496t50);
        if (c2496t502 == c2496t50) {
            return new C2496t50();
        }
        if (c2496t502 == null) {
            atomicReference.set(null);
            return new C2496t50();
        }
        atomicReference.set(c2496t502.f);
        c2496t502.f = null;
        c2496t502.c = 0;
        return c2496t502;
    }
}
