// 
// Decompiled by Procyon v0.6.0
// 

package io.netty.util.internal.shaded.org.jctools.queues.atomic;

import java.util.concurrent.atomic.AtomicLongArray;
import java.util.concurrent.atomic.AtomicReferenceArray;

public final class AtomicQueueUtil
{
    public static <E> E lvRefElement(final AtomicReferenceArray<E> buffer, final int offset) {
        return buffer.get(offset);
    }
    
    public static <E> E lpRefElement(final AtomicReferenceArray<E> buffer, final int offset) {
        return buffer.get(offset);
    }
    
    public static <E> void spRefElement(final AtomicReferenceArray<E> buffer, final int offset, final E value) {
        buffer.lazySet(offset, value);
    }
    
    public static void soRefElement(final AtomicReferenceArray buffer, final int offset, final Object value) {
        buffer.lazySet(offset, value);
    }
    
    public static <E> void svRefElement(final AtomicReferenceArray<E> buffer, final int offset, final E value) {
        buffer.set(offset, value);
    }
    
    public static int calcRefElementOffset(final long index) {
        return (int)index;
    }
    
    public static int calcCircularRefElementOffset(final long index, final long mask) {
        return (int)(index & mask);
    }
    
    public static <E> AtomicReferenceArray<E> allocateRefArray(final int capacity) {
        return new AtomicReferenceArray<E>(capacity);
    }
    
    public static void spLongElement(final AtomicLongArray buffer, final int offset, final long e) {
        buffer.lazySet(offset, e);
    }
    
    public static void soLongElement(final AtomicLongArray buffer, final int offset, final long e) {
        buffer.lazySet(offset, e);
    }
    
    public static long lpLongElement(final AtomicLongArray buffer, final int offset) {
        return buffer.get(offset);
    }
    
    public static long lvLongElement(final AtomicLongArray buffer, final int offset) {
        return buffer.get(offset);
    }
    
    public static int calcLongElementOffset(final long index) {
        return (int)index;
    }
    
    public static int calcCircularLongElementOffset(final long index, final int mask) {
        return (int)(index & (long)mask);
    }
    
    public static AtomicLongArray allocateLongArray(final int capacity) {
        return new AtomicLongArray(capacity);
    }
    
    public static int length(final AtomicReferenceArray<?> buf) {
        return buf.length();
    }
    
    public static int modifiedCalcCircularRefElementOffset(final long index, final long mask) {
        return (int)(index & mask) >> 1;
    }
    
    public static int nextArrayOffset(final AtomicReferenceArray<?> curr) {
        return length(curr) - 1;
    }
}
