discord-jadx/app/src/main/java/c/i/a/c/h2/m.java

62 lines
1.5 KiB
Java

package c.i.a.c.h2;
import c.i.a.c.i2.f0;
import com.airbnb.lottie.parser.AnimatableValueParser;
import java.util.Arrays;
/* compiled from: DefaultAllocator */
public final class m {
public final boolean a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final c[] f884c;
public int d;
public int e;
public int f;
public c[] g;
public m(boolean z2, int i) {
AnimatableValueParser.k(i > 0);
AnimatableValueParser.k(true);
this.a = z2;
this.b = i;
this.f = 0;
this.g = new c[100];
this.f884c = new c[1];
}
public synchronized void a(c[] cVarArr) {
int i = this.f;
int length = cVarArr.length + i;
c[] cVarArr2 = this.g;
if (length >= cVarArr2.length) {
this.g = (c[]) Arrays.copyOf(cVarArr2, Math.max(cVarArr2.length * 2, i + cVarArr.length));
}
for (c cVar : cVarArr) {
c[] cVarArr3 = this.g;
int i2 = this.f;
this.f = i2 + 1;
cVarArr3[i2] = cVar;
}
this.e -= cVarArr.length;
notifyAll();
}
public synchronized void b(int i) {
boolean z2 = i < this.d;
this.d = i;
if (z2) {
c();
}
}
public synchronized void c() {
int max = Math.max(0, f0.f(this.d, this.b) - this.e);
int i = this.f;
if (max < i) {
Arrays.fill(this.g, max, i, (Object) null);
this.f = max;
}
}
}