discord-jadx/app/src/main/java/j0/l/e/n/n.java

72 lines
1.4 KiB
Java
Raw Normal View History

2021-06-27 20:44:35 +00:00
package j0.l.e.n;
import java.util.Objects;
/* compiled from: SpscArrayQueue */
public final class n<E> {
public n(int i) {
super(i);
}
public final long i() {
return y.a.getLongVolatile(this, o.p);
}
public boolean isEmpty() {
return j() == i();
}
public final long j() {
return y.a.getLongVolatile(this, r.o);
}
public final void k(long j) {
y.a.putOrderedLong(this, o.p, j);
}
public final void l(long j) {
y.a.putOrderedLong(this, r.o, j);
}
public boolean offer(E e) {
Objects.requireNonNull(e, "null elements not allowed");
E[] eArr = this.m;
long j = this.producerIndex;
long c2 = c(j);
if (e(eArr, c2) != null) {
return false;
}
g(eArr, c2, e);
l(j + 1);
return true;
}
public E peek() {
return e(this.m, c(this.consumerIndex));
}
public E poll() {
long j = this.consumerIndex;
long c2 = c(j);
E[] eArr = this.m;
E e = e(eArr, c2);
if (e == null) {
return null;
}
g(eArr, c2, null);
k(j + 1);
return e;
}
public int size() {
long i = i();
while (true) {
long j = j();
long i2 = i();
if (i == i2) {
return (int) (j - i2);
}
i = i2;
}
}
}