package androidx.collection; import kotlin.ULong; import kotlin.collections.ArraysKt___ArraysJvmKt; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function2; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.SourceDebugExtension; @SourceDebugExtension({"SMAP\nIntIntMap.kt\nKotlin\n*S Kotlin\n*F\n+ 1 IntIntMap.kt\nandroidx/collection/MutableIntIntMap\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 ScatterMap.kt\nandroidx/collection/ScatterMapKt\n+ 4 IntIntMap.kt\nandroidx/collection/IntIntMap\n+ 5 IntSet.kt\nandroidx/collection/IntSet\n+ 6 IntList.kt\nandroidx/collection/IntList\n+ 7 IntSet.kt\nandroidx/collection/IntSetKt\n*L\n1#1,1047:1\n1037#1,2:1134\n1041#1,5:1142\n1037#1,2:1173\n1041#1,5:1181\n1037#1,2:1198\n1041#1,5:1206\n1037#1,2:1212\n1041#1,5:1220\n1#2:1048\n1672#3,6:1049\n1826#3:1065\n1688#3:1069\n1826#3:1087\n1688#3:1091\n1826#3:1112\n1688#3:1116\n1672#3,6:1136\n1672#3,6:1147\n1615#3:1156\n1619#3:1157\n1795#3,3:1158\n1809#3,3:1161\n1733#3:1164\n1721#3:1165\n1715#3:1166\n1728#3:1167\n1818#3:1168\n1682#3:1169\n1661#3:1170\n1680#3:1171\n1661#3:1172\n1672#3,6:1175\n1795#3,3:1186\n1826#3:1189\n1715#3:1190\n1685#3:1191\n1661#3:1192\n1615#3:1196\n1619#3:1197\n1672#3,6:1200\n1661#3:1211\n1672#3,6:1214\n1672#3,6:1225\n1672#3,6:1231\n385#4,4:1055\n357#4,6:1059\n367#4,3:1066\n370#4,2:1070\n389#4,2:1072\n373#4,6:1074\n391#4:1080\n357#4,6:1081\n367#4,3:1088\n370#4,9:1092\n262#5,4:1101\n232#5,7:1105\n243#5,3:1113\n246#5,2:1117\n266#5,2:1119\n249#5,6:1121\n268#5:1127\n253#6,6:1128\n849#7,3:1153\n849#7,3:1193\n*S KotlinDebug\n*F\n+ 1 IntIntMap.kt\nandroidx/collection/MutableIntIntMap\n*L\n875#1:1134,2\n875#1:1142,5\n933#1:1173,2\n933#1:1181,5\n1007#1:1198,2\n1007#1:1206,5\n1023#1:1212,2\n1023#1:1220,5\n711#1:1049,6\n789#1:1065\n789#1:1069\n828#1:1087\n828#1:1091\n855#1:1112\n855#1:1116\n875#1:1136,6\n885#1:1147,6\n899#1:1156\n900#1:1157\n907#1:1158,3\n908#1:1161,3\n909#1:1164\n910#1:1165\n910#1:1166\n914#1:1167\n917#1:1168\n926#1:1169\n926#1:1170\n932#1:1171\n932#1:1172\n933#1:1175,6\n948#1:1186,3\n949#1:1189\n951#1:1190\n1002#1:1191\n1002#1:1192\n1005#1:1196\n1007#1:1197\n1007#1:1200,6\n1021#1:1211\n1023#1:1214,6\n1038#1:1225,6\n1044#1:1231,6\n789#1:1055,4\n789#1:1059,6\n789#1:1066,3\n789#1:1070,2\n789#1:1072,2\n789#1:1074,6\n789#1:1080\n828#1:1081,6\n828#1:1088,3\n828#1:1092,9\n855#1:1101,4\n855#1:1105,7\n855#1:1113,3\n855#1:1117,2\n855#1:1119,2\n855#1:1121,6\n855#1:1127\n864#1:1128,6\n898#1:1153,3\n1004#1:1193,3\n*E\n"}) /* loaded from: classes.dex */ public final class MutableIntIntMap extends IntIntMap { private int growthLimit; public MutableIntIntMap() { this(0, 1, null); } public final void minusAssign(IntList keys) { Intrinsics.checkNotNullParameter(keys, "keys"); int[] iArr = keys.content; int i = keys._size; for (int i2 = 0; i2 < i; i2++) { remove(iArr[i2]); } } public final void minusAssign(IntSet keys) { Intrinsics.checkNotNullParameter(keys, "keys"); int[] iArr = keys.elements; long[] jArr = keys.metadata; int length = jArr.length - 2; if (length < 0) { return; } int i = 0; while (true) { long j = jArr[i]; if ((((~j) << 7) & j & (-9187201950435737472L)) != -9187201950435737472L) { int i2 = 8 - ((~(i - length)) >>> 31); for (int i3 = 0; i3 < i2; i3++) { if ((255 & j) < 128) { remove(iArr[(i << 3) + i3]); } j >>= 8; } if (i2 != 8) { return; } } if (i == length) { return; } else { i++; } } } public final void removeIf(Function2 predicate) { Intrinsics.checkNotNullParameter(predicate, "predicate"); long[] jArr = this.metadata; int length = jArr.length - 2; if (length < 0) { return; } int i = 0; while (true) { long j = jArr[i]; if ((((~j) << 7) & j & (-9187201950435737472L)) != -9187201950435737472L) { int i2 = 8 - ((~(i - length)) >>> 31); for (int i3 = 0; i3 < i2; i3++) { if ((255 & j) < 128) { int i4 = (i << 3) + i3; if (((Boolean) predicate.invoke(Integer.valueOf(this.keys[i4]), Integer.valueOf(this.values[i4]))).booleanValue()) { removeValueAt(i4); } } j >>= 8; } if (i2 != 8) { return; } } if (i == length) { return; } else { i++; } } } public final void putAll(IntIntMap from) { Intrinsics.checkNotNullParameter(from, "from"); int[] iArr = from.keys; int[] iArr2 = from.values; long[] jArr = from.metadata; int length = jArr.length - 2; if (length < 0) { return; } int i = 0; while (true) { long j = jArr[i]; if ((((~j) << 7) & j & (-9187201950435737472L)) != -9187201950435737472L) { int i2 = 8 - ((~(i - length)) >>> 31); for (int i3 = 0; i3 < i2; i3++) { if ((255 & j) < 128) { int i4 = (i << 3) + i3; set(iArr[i4], iArr2[i4]); } j >>= 8; } if (i2 != 8) { return; } } if (i == length) { return; } else { i++; } } } public /* synthetic */ MutableIntIntMap(int i, int i2, DefaultConstructorMarker defaultConstructorMarker) { this((i2 & 1) != 0 ? 6 : i); } public MutableIntIntMap(int i) { super(null); if (i < 0) { throw new IllegalArgumentException("Capacity must be a positive value.".toString()); } initializeStorage(ScatterMapKt.unloadedCapacity(i)); } private final void initializeStorage(int i) { int max = i > 0 ? Math.max(7, ScatterMapKt.normalizeCapacity(i)) : 0; this._capacity = max; initializeMetadata(max); this.keys = new int[max]; this.values = new int[max]; } private final void initializeMetadata(int i) { long[] jArr; if (i == 0) { jArr = ScatterMapKt.EmptyGroup; } else { jArr = new long[((i + 15) & (-8)) >> 3]; ArraysKt___ArraysJvmKt.fill$default(jArr, -9187201950435737472L, 0, 0, 6, (Object) null); } this.metadata = jArr; int i2 = i >> 3; long j = 255 << ((i & 7) << 3); jArr[i2] = (jArr[i2] & (~j)) | j; initializeGrowth(); } private final void initializeGrowth() { this.growthLimit = ScatterMapKt.loadedCapacity(getCapacity()) - this._size; } public final int getOrPut(int i, Function0 defaultValue) { Intrinsics.checkNotNullParameter(defaultValue, "defaultValue"); int findKeyIndex = findKeyIndex(i); if (findKeyIndex < 0) { int intValue = ((Number) defaultValue.invoke()).intValue(); put(i, intValue); return intValue; } return this.values[findKeyIndex]; } public final void set(int i, int i2) { int findInsertIndex = findInsertIndex(i); if (findInsertIndex < 0) { findInsertIndex = ~findInsertIndex; } this.keys[findInsertIndex] = i; this.values[findInsertIndex] = i2; } public final void put(int i, int i2) { set(i, i2); } public final int put(int i, int i2, int i3) { int findInsertIndex = findInsertIndex(i); if (findInsertIndex < 0) { findInsertIndex = ~findInsertIndex; } else { i3 = this.values[findInsertIndex]; } this.keys[findInsertIndex] = i; this.values[findInsertIndex] = i2; return i3; } public final void plusAssign(IntIntMap from) { Intrinsics.checkNotNullParameter(from, "from"); putAll(from); } public final void remove(int i) { int findKeyIndex = findKeyIndex(i); if (findKeyIndex >= 0) { removeValueAt(findKeyIndex); } } public final boolean remove(int i, int i2) { int findKeyIndex = findKeyIndex(i); if (findKeyIndex < 0 || this.values[findKeyIndex] != i2) { return false; } removeValueAt(findKeyIndex); return true; } public final void minusAssign(int i) { remove(i); } public final void minusAssign(int[] keys) { Intrinsics.checkNotNullParameter(keys, "keys"); for (int i : keys) { remove(i); } } private final int findInsertIndex(int i) { int hashCode = Integer.hashCode(i) * ScatterMapKt.MurmurHashC1; int i2 = hashCode ^ (hashCode << 16); int i3 = i2 >>> 7; int i4 = i2 & 127; int i5 = this._capacity; int i6 = i3 & i5; int i7 = 0; while (true) { long[] jArr = this.metadata; int i8 = i6 >> 3; int i9 = (i6 & 7) << 3; long j = ((jArr[i8 + 1] << (64 - i9)) & ((-i9) >> 63)) | (jArr[i8] >>> i9); long j2 = i4; int i10 = i7; long j3 = j ^ (j2 * ScatterMapKt.BitmaskLsb); for (long j4 = (~j3) & (j3 - ScatterMapKt.BitmaskLsb) & (-9187201950435737472L); j4 != 0; j4 &= j4 - 1) { int numberOfTrailingZeros = ((Long.numberOfTrailingZeros(j4) >> 3) + i6) & i5; if (this.keys[numberOfTrailingZeros] == i) { return numberOfTrailingZeros; } } if ((((~j) << 6) & j & (-9187201950435737472L)) != 0) { int findFirstAvailableSlot = findFirstAvailableSlot(i3); if (this.growthLimit == 0 && ((this.metadata[findFirstAvailableSlot >> 3] >> ((findFirstAvailableSlot & 7) << 3)) & 255) != 254) { adjustStorage(); findFirstAvailableSlot = findFirstAvailableSlot(i3); } this._size++; int i11 = this.growthLimit; long[] jArr2 = this.metadata; int i12 = findFirstAvailableSlot >> 3; long j5 = jArr2[i12]; int i13 = (findFirstAvailableSlot & 7) << 3; this.growthLimit = i11 - (((j5 >> i13) & 255) == 128 ? 1 : 0); jArr2[i12] = ((~(255 << i13)) & j5) | (j2 << i13); int i14 = this._capacity; int i15 = ((findFirstAvailableSlot - 7) & i14) + (i14 & 7); int i16 = i15 >> 3; int i17 = (i15 & 7) << 3; jArr2[i16] = ((~(255 << i17)) & jArr2[i16]) | (j2 << i17); return ~findFirstAvailableSlot; } i7 = i10 + 8; i6 = (i6 + i7) & i5; } } public final void clear() { this._size = 0; long[] jArr = this.metadata; if (jArr != ScatterMapKt.EmptyGroup) { ArraysKt___ArraysJvmKt.fill$default(jArr, -9187201950435737472L, 0, 0, 6, (Object) null); long[] jArr2 = this.metadata; int i = this._capacity; int i2 = i >> 3; long j = 255 << ((i & 7) << 3); jArr2[i2] = (jArr2[i2] & (~j)) | j; } initializeGrowth(); } public final int trim() { int i = this._capacity; int normalizeCapacity = ScatterMapKt.normalizeCapacity(ScatterMapKt.unloadedCapacity(this._size)); if (normalizeCapacity >= i) { return 0; } resizeStorage(normalizeCapacity); return i - this._capacity; } private final void adjustStorage() { if (this._capacity > 8 && Long.compareUnsigned(ULong.m4068constructorimpl(ULong.m4068constructorimpl(this._size) * 32), ULong.m4068constructorimpl(ULong.m4068constructorimpl(this._capacity) * 25)) <= 0) { removeDeletedMarkers(); } else { resizeStorage(ScatterMapKt.nextCapacity(this._capacity)); } } private final void resizeStorage(int i) { long[] jArr; int[] iArr; long[] jArr2 = this.metadata; int[] iArr2 = this.keys; int[] iArr3 = this.values; int i2 = this._capacity; initializeStorage(i); int[] iArr4 = this.keys; int[] iArr5 = this.values; int i3 = 0; while (i3 < i2) { if (((jArr2[i3 >> 3] >> ((i3 & 7) << 3)) & 255) < 128) { int i4 = iArr2[i3]; int hashCode = Integer.hashCode(i4) * ScatterMapKt.MurmurHashC1; int i5 = hashCode ^ (hashCode << 16); int findFirstAvailableSlot = findFirstAvailableSlot(i5 >>> 7); long j = i5 & 127; long[] jArr3 = this.metadata; int i6 = findFirstAvailableSlot >> 3; int i7 = (findFirstAvailableSlot & 7) << 3; jArr = jArr2; iArr = iArr2; jArr3[i6] = (jArr3[i6] & (~(255 << i7))) | (j << i7); int i8 = this._capacity; int i9 = ((findFirstAvailableSlot - 7) & i8) + (i8 & 7); int i10 = i9 >> 3; int i11 = (i9 & 7) << 3; jArr3[i10] = ((~(255 << i11)) & jArr3[i10]) | (j << i11); iArr4[findFirstAvailableSlot] = i4; iArr5[findFirstAvailableSlot] = iArr3[i3]; } else { jArr = jArr2; iArr = iArr2; } i3++; jArr2 = jArr; iArr2 = iArr; } } private final void removeDeletedMarkers() { long[] jArr = this.metadata; int i = this._capacity; int i2 = 0; for (int i3 = 0; i3 < i; i3++) { int i4 = i3 >> 3; int i5 = (i3 & 7) << 3; if (((jArr[i4] >> i5) & 255) == 254) { long[] jArr2 = this.metadata; jArr2[i4] = (128 << i5) | (jArr2[i4] & (~(255 << i5))); int i6 = this._capacity; int i7 = ((i3 - 7) & i6) + (i6 & 7); int i8 = i7 >> 3; int i9 = (i7 & 7) << 3; jArr2[i8] = ((~(255 << i9)) & jArr2[i8]) | (128 << i9); i2++; } } this.growthLimit += i2; } private final void writeMetadata(int i, long j) { long[] jArr = this.metadata; int i2 = i >> 3; int i3 = (i & 7) << 3; jArr[i2] = (jArr[i2] & (~(255 << i3))) | (j << i3); int i4 = this._capacity; int i5 = ((i - 7) & i4) + (i4 & 7); int i6 = i5 >> 3; int i7 = (i5 & 7) << 3; jArr[i6] = (j << i7) | (jArr[i6] & (~(255 << i7))); } public final void removeValueAt(int i) { this._size--; long[] jArr = this.metadata; int i2 = i >> 3; int i3 = (i & 7) << 3; jArr[i2] = (jArr[i2] & (~(255 << i3))) | (254 << i3); int i4 = this._capacity; int i5 = ((i - 7) & i4) + (i4 & 7); int i6 = i5 >> 3; int i7 = (i5 & 7) << 3; jArr[i6] = (jArr[i6] & (~(255 << i7))) | (254 << i7); } private final int findFirstAvailableSlot(int i) { int i2 = this._capacity; int i3 = i & i2; int i4 = 0; while (true) { long[] jArr = this.metadata; int i5 = i3 >> 3; int i6 = (i3 & 7) << 3; long j = ((jArr[i5 + 1] << (64 - i6)) & ((-i6) >> 63)) | (jArr[i5] >>> i6); long j2 = j & ((~j) << 7) & (-9187201950435737472L); if (j2 != 0) { return (i3 + (Long.numberOfTrailingZeros(j2) >> 3)) & i2; } i4 += 8; i3 = (i3 + i4) & i2; } } }