what-the-bank/sources/com/google/firebase/firestore/index/IntMath.java

97 lines
3.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.firestore.index;
import java.math.RoundingMode;
/* loaded from: classes2.dex */
public final class IntMath {
public static int divide(int i, int i2, RoundingMode roundingMode) {
if (i2 == 0) {
throw new ArithmeticException("/ by zero");
}
int i3 = i / i2;
int i4 = i - (i2 * i3);
if (i4 == 0) {
return i3;
}
int i5 = ((i ^ i2) >> 31) | 1;
switch (AnonymousClass1.$SwitchMap$java$math$RoundingMode[roundingMode.ordinal()]) {
case 1:
case 2:
return i3;
case 3:
break;
case 4:
if (i5 <= 0) {
return i3;
}
break;
case 5:
if (i5 >= 0) {
return i3;
}
break;
case 6:
case 7:
case 8:
int abs = Math.abs(i4);
int abs2 = abs - (Math.abs(i2) - abs);
if (abs2 == 0) {
if (roundingMode != RoundingMode.HALF_UP) {
if (!((roundingMode == RoundingMode.HALF_EVEN) & ((i3 & 1) != 0))) {
return i3;
}
}
} else if (abs2 <= 0) {
return i3;
}
break;
default:
throw new AssertionError();
}
return i3 + i5;
}
/* renamed from: com.google.firebase.firestore.index.IntMath$1, reason: invalid class name */
/* loaded from: classes2.dex */
static /* synthetic */ class AnonymousClass1 {
static final int[] $SwitchMap$java$math$RoundingMode;
static {
int[] iArr = new int[RoundingMode.values().length];
$SwitchMap$java$math$RoundingMode = iArr;
try {
iArr[RoundingMode.UNNECESSARY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$java$math$RoundingMode[RoundingMode.DOWN.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$java$math$RoundingMode[RoundingMode.UP.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$java$math$RoundingMode[RoundingMode.CEILING.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$java$math$RoundingMode[RoundingMode.FLOOR.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$java$math$RoundingMode[RoundingMode.HALF_EVEN.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$java$math$RoundingMode[RoundingMode.HALF_DOWN.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$java$math$RoundingMode[RoundingMode.HALF_UP.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
}
}
}