package c.i.a.c.i2; import com.airbnb.lottie.parser.AnimatableValueParser; /* compiled from: ParsableBitArray */ public final class v { public byte[] a; public int b; /* renamed from: c reason: collision with root package name */ public int f912c; public int d; public v() { this.a = f0.f; } public v(byte[] bArr) { int length = bArr.length; this.a = bArr; this.d = length; } public v(byte[] bArr, int i) { this.a = bArr; this.d = i; } public final void a() { int i; int i2 = this.b; AnimatableValueParser.D(i2 >= 0 && (i2 < (i = this.d) || (i2 == i && this.f912c == 0))); } public int b() { return ((this.d - this.b) * 8) - this.f912c; } public void c() { if (this.f912c != 0) { this.f912c = 0; this.b++; a(); } } public int d() { AnimatableValueParser.D(this.f912c == 0); return this.b; } public int e() { return (this.b * 8) + this.f912c; } public boolean f() { boolean z2 = (this.a[this.b] & (128 >> this.f912c)) != 0; l(); return z2; } public int g(int i) { int i2; if (i == 0) { return 0; } this.f912c += i; int i3 = 0; while (true) { i2 = this.f912c; if (i2 <= 8) { break; } int i4 = i2 - 8; this.f912c = i4; byte[] bArr = this.a; int i5 = this.b; this.b = i5 + 1; i3 |= (bArr[i5] & 255) << i4; } byte[] bArr2 = this.a; int i6 = this.b; int i7 = (-1 >>> (32 - i)) & (i3 | ((bArr2[i6] & 255) >> (8 - i2))); if (i2 == 8) { this.f912c = 0; this.b = i6 + 1; } a(); return i7; } public void h(byte[] bArr, int i, int i2) { int i3 = (i2 >> 3) + i; while (i < i3) { byte[] bArr2 = this.a; int i4 = this.b; int i5 = i4 + 1; this.b = i5; byte b = bArr2[i4]; int i6 = this.f912c; bArr[i] = (byte) (b << i6); bArr[i] = (byte) (((255 & bArr2[i5]) >> (8 - i6)) | bArr[i]); i++; } int i7 = i2 & 7; if (i7 != 0) { bArr[i3] = (byte) (bArr[i3] & (255 >> i7)); int i8 = this.f912c; if (i8 + i7 > 8) { byte b2 = bArr[i3]; byte[] bArr3 = this.a; int i9 = this.b; this.b = i9 + 1; bArr[i3] = (byte) (b2 | ((bArr3[i9] & 255) << i8)); this.f912c = i8 - 8; } int i10 = this.f912c + i7; this.f912c = i10; byte[] bArr4 = this.a; int i11 = this.b; bArr[i3] = (byte) (((byte) (((255 & bArr4[i11]) >> (8 - i10)) << (8 - i7))) | bArr[i3]); if (i10 == 8) { this.f912c = 0; this.b = i11 + 1; } a(); } } public void i(byte[] bArr, int i, int i2) { AnimatableValueParser.D(this.f912c == 0); System.arraycopy(this.a, this.b, bArr, i, i2); this.b += i2; a(); } public void j(byte[] bArr, int i) { this.a = bArr; this.b = 0; this.f912c = 0; this.d = i; } public void k(int i) { int i2 = i / 8; this.b = i2; this.f912c = i - (i2 * 8); a(); } public void l() { int i = this.f912c + 1; this.f912c = i; if (i == 8) { this.f912c = 0; this.b++; } a(); } public void m(int i) { int i2 = i / 8; int i3 = this.b + i2; this.b = i3; int i4 = (i - (i2 * 8)) + this.f912c; this.f912c = i4; if (i4 > 7) { this.b = i3 + 1; this.f912c = i4 - 8; } a(); } public void n(int i) { AnimatableValueParser.D(this.f912c == 0); this.b += i; a(); } }