package com.google.android.gms.internal.vision; /* loaded from: classes2.dex */ public final class zzjp implements Cloneable { private static final zzjq zzadi = new zzjq(); private int mSize; private boolean zzadj; private int[] zzadk; private zzjq[] zzadl; /* JADX INFO: Access modifiers changed from: package-private */ public zzjp() { this(10); } private zzjp(int i) { this.zzadj = false; int idealIntArraySize = idealIntArraySize(i); this.zzadk = new int[idealIntArraySize]; this.zzadl = new zzjq[idealIntArraySize]; this.mSize = 0; } /* JADX INFO: Access modifiers changed from: package-private */ public final zzjq zzbw(int i) { zzjq zzjqVar; int zzby = zzby(i); if (zzby < 0 || (zzjqVar = this.zzadl[zzby]) == zzadi) { return null; } return zzjqVar; } /* JADX INFO: Access modifiers changed from: package-private */ public final void zza(int i, zzjq zzjqVar) { int zzby = zzby(i); if (zzby >= 0) { this.zzadl[zzby] = zzjqVar; return; } int i2 = ~zzby; int i3 = this.mSize; if (i2 < i3) { zzjq[] zzjqVarArr = this.zzadl; if (zzjqVarArr[i2] == zzadi) { this.zzadk[i2] = i; zzjqVarArr[i2] = zzjqVar; return; } } if (i3 >= this.zzadk.length) { int idealIntArraySize = idealIntArraySize(i3 + 1); int[] iArr = new int[idealIntArraySize]; zzjq[] zzjqVarArr2 = new zzjq[idealIntArraySize]; int[] iArr2 = this.zzadk; System.arraycopy(iArr2, 0, iArr, 0, iArr2.length); zzjq[] zzjqVarArr3 = this.zzadl; System.arraycopy(zzjqVarArr3, 0, zzjqVarArr2, 0, zzjqVarArr3.length); this.zzadk = iArr; this.zzadl = zzjqVarArr2; } int i4 = this.mSize - i2; if (i4 != 0) { int[] iArr3 = this.zzadk; int i5 = i2 + 1; System.arraycopy(iArr3, i2, iArr3, i5, i4); zzjq[] zzjqVarArr4 = this.zzadl; System.arraycopy(zzjqVarArr4, i2, zzjqVarArr4, i5, this.mSize - i2); } this.zzadk[i2] = i; this.zzadl[i2] = zzjqVar; this.mSize++; } /* JADX INFO: Access modifiers changed from: package-private */ public final zzjq zzbx(int i) { return this.zzadl[i]; } public final boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof zzjp)) { return false; } zzjp zzjpVar = (zzjp) obj; int i = this.mSize; if (i != zzjpVar.mSize) { return false; } int[] iArr = this.zzadk; int[] iArr2 = zzjpVar.zzadk; int i2 = 0; while (true) { if (i2 < i) { if (iArr[i2] != iArr2[i2]) { break; } i2++; } else { zzjq[] zzjqVarArr = this.zzadl; zzjq[] zzjqVarArr2 = zzjpVar.zzadl; int i3 = this.mSize; for (int i4 = 0; i4 < i3; i4++) { if (zzjqVarArr[i4].equals(zzjqVarArr2[i4])) { } } return true; } } return false; } public final int hashCode() { int i = 17; for (int i2 = 0; i2 < this.mSize; i2++) { i = (((i * 31) + this.zzadk[i2]) * 31) + this.zzadl[i2].hashCode(); } return i; } private static int idealIntArraySize(int i) { int i2 = i << 2; int i3 = 4; while (true) { if (i3 >= 32) { break; } int i4 = (1 << i3) - 12; if (i2 <= i4) { i2 = i4; break; } i3++; } return i2 / 4; } private final int zzby(int i) { int i2 = this.mSize - 1; int i3 = 0; while (i3 <= i2) { int i4 = (i3 + i2) >>> 1; int i5 = this.zzadk[i4]; if (i5 < i) { i3 = i4 + 1; } else { if (i5 <= i) { return i4; } i2 = i4 - 1; } } return ~i3; } public final /* synthetic */ Object clone() throws CloneNotSupportedException { int i = this.mSize; zzjp zzjpVar = new zzjp(i); System.arraycopy(this.zzadk, 0, zzjpVar.zzadk, 0, i); for (int i2 = 0; i2 < i; i2++) { zzjq zzjqVar = this.zzadl[i2]; if (zzjqVar != null) { zzjpVar.zzadl[i2] = (zzjq) zzjqVar.clone(); } } zzjpVar.mSize = i; return zzjpVar; } /* JADX INFO: Access modifiers changed from: package-private */ public final int size() { return this.mSize; } }