mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 17:42:33 -06:00
159 lines
6.7 KiB
Java
159 lines
6.7 KiB
Java
package kotlin.text;
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import kotlin.Metadata;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* compiled from: StringNumberConversions.kt */
|
|
@Metadata(d1 = {"\u0000.\n\u0000\n\u0002\u0010\u0001\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0005\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\n\n\u0002\b\u0003\u001a\u0010\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0000\u001a\u0013\u0010\u0004\u001a\u0004\u0018\u00010\u0005*\u00020\u0003H\u0007¢\u0006\u0002\u0010\u0006\u001a\u001b\u0010\u0004\u001a\u0004\u0018\u00010\u0005*\u00020\u00032\u0006\u0010\u0007\u001a\u00020\bH\u0007¢\u0006\u0002\u0010\t\u001a\u0013\u0010\n\u001a\u0004\u0018\u00010\b*\u00020\u0003H\u0007¢\u0006\u0002\u0010\u000b\u001a\u001b\u0010\n\u001a\u0004\u0018\u00010\b*\u00020\u00032\u0006\u0010\u0007\u001a\u00020\bH\u0007¢\u0006\u0002\u0010\f\u001a\u0013\u0010\r\u001a\u0004\u0018\u00010\u000e*\u00020\u0003H\u0007¢\u0006\u0002\u0010\u000f\u001a\u001b\u0010\r\u001a\u0004\u0018\u00010\u000e*\u00020\u00032\u0006\u0010\u0007\u001a\u00020\bH\u0007¢\u0006\u0002\u0010\u0010\u001a\u0013\u0010\u0011\u001a\u0004\u0018\u00010\u0012*\u00020\u0003H\u0007¢\u0006\u0002\u0010\u0013\u001a\u001b\u0010\u0011\u001a\u0004\u0018\u00010\u0012*\u00020\u00032\u0006\u0010\u0007\u001a\u00020\bH\u0007¢\u0006\u0002\u0010\u0014¨\u0006\u0015"}, d2 = {"numberFormatError", "", "input", "", "toByteOrNull", "", "(Ljava/lang/String;)Ljava/lang/Byte;", "radix", "", "(Ljava/lang/String;I)Ljava/lang/Byte;", "toIntOrNull", "(Ljava/lang/String;)Ljava/lang/Integer;", "(Ljava/lang/String;I)Ljava/lang/Integer;", "toLongOrNull", "", "(Ljava/lang/String;)Ljava/lang/Long;", "(Ljava/lang/String;I)Ljava/lang/Long;", "toShortOrNull", "", "(Ljava/lang/String;)Ljava/lang/Short;", "(Ljava/lang/String;I)Ljava/lang/Short;", "kotlin-stdlib"}, k = 5, mv = {1, 9, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_EDITOR_ABSOLUTEX, xs = "kotlin/text/StringsKt")
|
|
/* loaded from: classes3.dex */
|
|
public class StringsKt__StringNumberConversionsKt extends StringsKt__StringNumberConversionsJVMKt {
|
|
public static final Byte toByteOrNull(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
return StringsKt.toByteOrNull(str, 10);
|
|
}
|
|
|
|
public static final Byte toByteOrNull(String str, int i) {
|
|
int intValue;
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Integer intOrNull = StringsKt.toIntOrNull(str, i);
|
|
if (intOrNull == null || (intValue = intOrNull.intValue()) < -128 || intValue > 127) {
|
|
return null;
|
|
}
|
|
return Byte.valueOf((byte) intValue);
|
|
}
|
|
|
|
public static final Short toShortOrNull(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
return StringsKt.toShortOrNull(str, 10);
|
|
}
|
|
|
|
public static final Short toShortOrNull(String str, int i) {
|
|
int intValue;
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Integer intOrNull = StringsKt.toIntOrNull(str, i);
|
|
if (intOrNull == null || (intValue = intOrNull.intValue()) < -32768 || intValue > 32767) {
|
|
return null;
|
|
}
|
|
return Short.valueOf((short) intValue);
|
|
}
|
|
|
|
public static final Integer toIntOrNull(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
return StringsKt.toIntOrNull(str, 10);
|
|
}
|
|
|
|
public static final Integer toIntOrNull(String str, int i) {
|
|
boolean z;
|
|
int i2;
|
|
int i3;
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
CharsKt.checkRadix(i);
|
|
int length = str.length();
|
|
if (length == 0) {
|
|
return null;
|
|
}
|
|
int i4 = 0;
|
|
char charAt = str.charAt(0);
|
|
int i5 = -2147483647;
|
|
if (Intrinsics.compare((int) charAt, 48) < 0) {
|
|
i2 = 1;
|
|
if (length == 1) {
|
|
return null;
|
|
}
|
|
if (charAt == '-') {
|
|
i5 = Integer.MIN_VALUE;
|
|
z = true;
|
|
} else {
|
|
if (charAt != '+') {
|
|
return null;
|
|
}
|
|
z = false;
|
|
}
|
|
} else {
|
|
z = false;
|
|
i2 = 0;
|
|
}
|
|
int i6 = -59652323;
|
|
while (i2 < length) {
|
|
int digitOf = CharsKt.digitOf(str.charAt(i2), i);
|
|
if (digitOf < 0) {
|
|
return null;
|
|
}
|
|
if ((i4 < i6 && (i6 != -59652323 || i4 < (i6 = i5 / i))) || (i3 = i4 * i) < i5 + digitOf) {
|
|
return null;
|
|
}
|
|
i4 = i3 - digitOf;
|
|
i2++;
|
|
}
|
|
return z ? Integer.valueOf(i4) : Integer.valueOf(-i4);
|
|
}
|
|
|
|
public static final Long toLongOrNull(String str) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
return StringsKt.toLongOrNull(str, 10);
|
|
}
|
|
|
|
public static final Long toLongOrNull(String str, int i) {
|
|
boolean z;
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
CharsKt.checkRadix(i);
|
|
int length = str.length();
|
|
if (length == 0) {
|
|
return null;
|
|
}
|
|
int i2 = 0;
|
|
char charAt = str.charAt(0);
|
|
long j = -9223372036854775807L;
|
|
if (Intrinsics.compare((int) charAt, 48) < 0) {
|
|
z = true;
|
|
if (length == 1) {
|
|
return null;
|
|
}
|
|
if (charAt == '-') {
|
|
j = Long.MIN_VALUE;
|
|
i2 = 1;
|
|
} else {
|
|
if (charAt != '+') {
|
|
return null;
|
|
}
|
|
z = false;
|
|
i2 = 1;
|
|
}
|
|
} else {
|
|
z = false;
|
|
}
|
|
long j2 = -256204778801521550L;
|
|
long j3 = 0;
|
|
long j4 = -256204778801521550L;
|
|
while (i2 < length) {
|
|
int digitOf = CharsKt.digitOf(str.charAt(i2), i);
|
|
if (digitOf < 0) {
|
|
return null;
|
|
}
|
|
if (j3 < j4) {
|
|
if (j4 == j2) {
|
|
j4 = j / i;
|
|
if (j3 < j4) {
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
long j5 = j3 * i;
|
|
long j6 = digitOf;
|
|
if (j5 < j + j6) {
|
|
return null;
|
|
}
|
|
j3 = j5 - j6;
|
|
i2++;
|
|
j2 = -256204778801521550L;
|
|
}
|
|
return z ? Long.valueOf(j3) : Long.valueOf(-j3);
|
|
}
|
|
|
|
public static final Void numberFormatError(String input) {
|
|
Intrinsics.checkNotNullParameter(input, "input");
|
|
throw new NumberFormatException("Invalid number format: '" + input + '\'');
|
|
}
|
|
}
|