* Decompile and recreate Soul Browser v1.4.85 with APK CI builds Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix CI build: include bundled google.jks and remove PR trigger The apktool build failed in CI because app/unknown/.../google.jks was excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files and commit the missing resource. Also remove the redundant pull_request workflow trigger. Co-authored-by: KaKi87 <KaKi87@pm.me> * Change package ID to com.github.kaki87.soulbrowser Rename the application ID so the rebuilt APK can be installed alongside the original Soul Browser from Google Play. - Update AndroidManifest package, permissions, providers, and actions - Update R class references in smali (com/github/kaki87/soulbrowser/R) - Update shortcuts.xml targetPackage - Rename app label to "Soul Rebuild" for easy identification Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix install compatibility: remove split APK metadata and bundle native libs The rebuilt APK still declared requiredSplitTypes and Play Store split metadata, causing Android to reject standalone installs as incompatible. - Remove requiredSplitTypes and split-related manifest meta-data - Merge native libs from all ABI splits with uncompressed storage - Page-align before signing for extractNativeLibs=false - Add .so to apktool doNotCompress list Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix install failure: use apksigner v2/v3 and bundle arm64 native libs Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only produces v1 signatures, causing Android to reject the install. - Sign with apksigner (v1+v2+v3) instead of jarsigner - Add arm64-v8a native libraries from universal Soul Browser 1.4.79 - Set extractNativeLibs=true for reliable sideload installs - Commit stable debug keystore for consistent signatures across builds Co-authored-by: KaKi87 <KaKi87@pm.me> * Add committed debug keystore for consistent APK signatures Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix startup crash: use original classes2.dex desugar libraries Apktool recompiles smali_classes2 into a broken classes2.dex, causing ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init. Inject the original classes2.dex (Java 8+ desugar libs) after apktool build instead of using the recompiled version. Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix missing drawable resources from density split APKs The base APK is an app bundle module; density-specific drawables like seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild, causing Resources$NotFoundException at runtime. - Merge non-9-patch resources from split APKs before apktool build - Sync public.xml IDs from R smali only when backing files exist - Add 713 density-specific resource IDs to public.xml Co-authored-by: KaKi87 <KaKi87@pm.me> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
976 lines
52 KiB
Java
976 lines
52 KiB
Java
package kotlin.text;
|
|
|
|
import com.google.android.gms.ads.RequestConfiguration;
|
|
import kotlin.ExperimentalStdlibApi;
|
|
import kotlin.KotlinNothingValueException;
|
|
import kotlin.KotlinVersion;
|
|
import kotlin.Metadata;
|
|
import kotlin.SinceKotlin;
|
|
import kotlin.UByte;
|
|
import kotlin.ULong;
|
|
import kotlin.UShort;
|
|
import kotlin.WasExperimental;
|
|
import kotlin.collections.AbstractList;
|
|
import kotlin.collections.ArraysKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
import kotlin.ranges.RangesKt;
|
|
import kotlin.text.HexFormat;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
@Metadata(d1 = {"\u0000r\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u0015\n\u0002\b\u0005\n\u0002\u0010\u0016\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010\u0019\n\u0002\b\u000b\n\u0002\u0010\t\n\u0002\b\u0006\n\u0002\u0010\u0005\n\u0002\b\t\n\u0002\u0010\n\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u000f\n\u0002\u0010\u0001\n\u0000\u001a\u0016\u0010\u000b\u001a\u00020\u0001*\u00020\f2\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a*\u0010\u000b\u001a\u00020\u0001*\u00020\f2\b\b\u0002\u0010\u000f\u001a\u00020\u00102\b\b\u0002\u0010\u0011\u001a\u00020\u00102\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a,\u0010\u0012\u001a\u00020\u0001*\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0004H\u0002\u001a,\u0010\u0016\u001a\u00020\u0001*\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0004H\u0002\u001a,\u0010\u0017\u001a\u00020\u0001*\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0004H\u0002\u001a,\u0010\u0018\u001a\u00020\u0001*\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0004H\u0002\u001a<\u0010\u0019\u001a\u00020\u0010*\u00020\f2\u0006\u0010\u001a\u001a\u00020\u00102\u0006\u0010\u001b\u001a\u00020\u00012\u0006\u0010\u001c\u001a\u00020\u00012\u0006\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u001d\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020\u0010H\u0002\u001a,\u0010\u0019\u001a\u00020\u0010*\u00020\f2\u0006\u0010\u001a\u001a\u00020\u00102\u0006\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u001d\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020\u0010H\u0002\u001a(\u0010 \u001a\u00020\u00102\u0006\u0010!\u001a\u00020\u00102\u0006\u0010\"\u001a\u00020\u00102\u0006\u0010#\u001a\u00020\u00102\u0006\u0010$\u001a\u00020\u0010H\u0002\u001a@\u0010 \u001a\u00020\u00102\u0006\u0010!\u001a\u00020\u00102\u0006\u0010%\u001a\u00020\u00102\u0006\u0010&\u001a\u00020\u00102\u0006\u0010'\u001a\u00020\u00102\u0006\u0010\"\u001a\u00020\u00102\u0006\u0010#\u001a\u00020\u00102\u0006\u0010$\u001a\u00020\u0010H\u0000\u001a\u0010\u0010(\u001a\u00020\u00102\u0006\u0010)\u001a\u00020*H\u0002\u001a\u0016\u0010+\u001a\u00020\f*\u00020\u00012\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a*\u0010+\u001a\u00020\f*\u00020\u00012\b\b\u0002\u0010\u000f\u001a\u00020\u00102\b\b\u0002\u0010\u0011\u001a\u00020\u00102\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0002\u001a&\u0010,\u001a\u0004\u0018\u00010\f*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u0014H\u0002\u001a&\u0010-\u001a\u0004\u0018\u00010\f*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u0014H\u0002\u001a&\u0010.\u001a\u0004\u0018\u00010\f*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u0014H\u0002\u001a$\u0010/\u001a\u00020\f*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u0014H\u0002\u001a\u0014\u00100\u001a\u000201*\u00020\u00012\u0006\u0010\u001a\u001a\u00020\u0010H\u0002\u001a@\u00102\u001a\u00020\u00102\u0006\u00103\u001a\u00020\u00102\u0006\u0010%\u001a\u00020\u00102\u0006\u0010&\u001a\u00020\u00102\u0006\u0010'\u001a\u00020\u00102\u0006\u0010\"\u001a\u00020\u00102\u0006\u0010#\u001a\u00020\u00102\u0006\u0010$\u001a\u00020\u0010H\u0000\u001a \u00104\u001a\u00020*2\u0006\u00105\u001a\u00020*2\u0006\u00106\u001a\u00020\u00102\u0006\u00107\u001a\u00020\u0010H\u0002\u001a \u00108\u001a\u00020*2\u0006\u00104\u001a\u00020*2\u0006\u00105\u001a\u00020*2\u0006\u00107\u001a\u00020\u0010H\u0002\u001a\u001c\u00109\u001a\u00020\u0010*\u00020\u00012\u0006\u0010\u001a\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0010H\u0002\u001a\u0016\u0010\u000b\u001a\u00020\u0001*\u0002012\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a\u0016\u0010:\u001a\u000201*\u00020\u00012\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a*\u0010:\u001a\u000201*\u00020\u00012\b\b\u0002\u0010\u000f\u001a\u00020\u00102\b\b\u0002\u0010\u0011\u001a\u00020\u00102\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0002\u001a\u0016\u0010\u000b\u001a\u00020\u0001*\u00020;2\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a\u0016\u0010<\u001a\u00020;*\u00020\u00012\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a*\u0010<\u001a\u00020;*\u00020\u00012\b\b\u0002\u0010\u000f\u001a\u00020\u00102\b\b\u0002\u0010\u0011\u001a\u00020\u00102\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0002\u001a\u0016\u0010\u000b\u001a\u00020\u0001*\u00020\u00102\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a\u0016\u0010=\u001a\u00020\u0010*\u00020\u00012\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a*\u0010=\u001a\u00020\u0010*\u00020\u00012\b\b\u0002\u0010\u000f\u001a\u00020\u00102\b\b\u0002\u0010\u0011\u001a\u00020\u00102\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0000\u001a\u0016\u0010\u000b\u001a\u00020\u0001*\u00020*2\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a\u0016\u0010>\u001a\u00020**\u00020\u00012\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0007\u001a*\u0010>\u001a\u00020**\u00020\u00012\b\b\u0002\u0010\u000f\u001a\u00020\u00102\b\b\u0002\u0010\u0011\u001a\u00020\u00102\b\b\u0002\u0010\r\u001a\u00020\u000eH\u0000\u001a$\u0010?\u001a\u00020\u0001*\u00020*2\u0006\u0010@\u001a\u00020A2\u0006\u0010B\u001a\u00020\u00012\u0006\u0010C\u001a\u00020\u0010H\u0002\u001a\u001c\u0010D\u001a\u00020\u0010*\u00020\u00012\u0006\u0010\u001d\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020\u0010H\u0002\u001a,\u0010E\u001a\u00020\u0010*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010F\u001a\u00020\u0010H\u0002\u001a,\u0010G\u001a\u00020**\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010F\u001a\u00020\u0010H\u0002\u001a<\u0010H\u001a\u00020I*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010J\u001a\u00020\u00012\u0006\u0010K\u001a\u00020\u00012\u0006\u0010L\u001a\u00020M2\u0006\u0010F\u001a\u00020\u0010H\u0002\u001a$\u0010N\u001a\u00020I*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010F\u001a\u00020\u0010H\u0002\u001a\u001c\u0010O\u001a\u00020I*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0010H\u0002\u001a\u001c\u0010P\u001a\u00020\u0010*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0010H\u0002\u001a\u001c\u0010Q\u001a\u00020**\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0010H\u0002\u001a5\u0010R\u001a\u00020\u0010*\u00020\u00012\u0006\u0010\u001a\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010S\u001a\u00020\u00012\u0006\u0010L\u001a\u00020M2\u0006\u0010T\u001a\u00020\u0001H\u0082\b\u001a\u0015\u0010U\u001a\u00020\u0010*\u00020\u00012\u0006\u0010\u001a\u001a\u00020\u0010H\u0082\b\u001a\u0015\u0010V\u001a\u00020**\u00020\u00012\u0006\u0010\u001a\u001a\u00020\u0010H\u0082\b\u001a,\u0010W\u001a\u00020I*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010X\u001a\u00020\u00012\u0006\u0010Y\u001a\u00020\u0010H\u0002\u001a,\u0010Z\u001a\u00020I*\u00020\u00012\u0006\u0010\u001a\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010S\u001a\u00020\u00012\u0006\u0010T\u001a\u00020\u0001H\u0002\u001a,\u0010[\u001a\u00020I*\u00020\u00012\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00102\u0006\u0010J\u001a\u00020\u00012\u0006\u0010K\u001a\u00020\u0001H\u0002\u001a\u0014\u0010\\\u001a\u00020]*\u00020\u00012\u0006\u0010\u001a\u001a\u00020\u0010H\u0002\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u0014\u0010\u0003\u001a\u00020\u0004X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u000e\u0010\u0007\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\b\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\t\u001a\u00020\nX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006^"}, d2 = {"LOWER_CASE_HEX_DIGITS", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "UPPER_CASE_HEX_DIGITS", "BYTE_TO_LOWER_CASE_HEX_DIGITS", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "getBYTE_TO_LOWER_CASE_HEX_DIGITS", "()[I", "BYTE_TO_UPPER_CASE_HEX_DIGITS", "HEX_DIGITS_TO_DECIMAL", "HEX_DIGITS_TO_LONG_DECIMAL", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "toHexString", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "format", "Lkotlin/text/HexFormat;", "startIndex", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "endIndex", "toHexStringNoLineAndGroupSeparator", "bytesFormat", "Lkotlin/text/HexFormat$BytesHexFormat;", "byteToDigits", "toHexStringShortByteSeparatorNoPrefixAndSuffix", "toHexStringNoLineAndGroupSeparatorSlowPath", "toHexStringSlowPath", "formatByteAt", "index", "bytePrefix", "byteSuffix", "destination", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "destinationOffset", "formattedStringLength", "numberOfBytes", "byteSeparatorLength", "bytePrefixLength", "byteSuffixLength", "bytesPerLine", "bytesPerGroup", "groupSeparatorLength", "checkFormatLength", "formatLength", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "hexToByteArray", "hexToByteArrayNoLineAndGroupSeparator", "hexToByteArrayShortByteSeparatorNoPrefixAndSuffix", "hexToByteArrayNoLineAndGroupSeparatorSlowPath", "hexToByteArraySlowPath", "parseByteAt", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "parsedByteArrayMaxSize", "stringLength", "charsPerSet", "charsPerElement", "elementsPerSet", "elementSeparatorLength", "wholeElementsPerSet", "checkNewLineAt", "hexToByte", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "hexToShort", "hexToInt", "hexToLong", "toHexStringImpl", "numberFormat", "Lkotlin/text/HexFormat$NumberHexFormat;", "digits", "bits", "toCharArrayIfNotEmpty", "hexToIntImpl", "typeHexLength", "hexToLongImpl", "checkPrefixSuffixNumberOfDigits", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "prefix", "suffix", "ignoreCase", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "checkNumberOfDigits", "checkZeroDigits", "parseInt", "parseLong", "checkContainsAt", "part", "partName", "decimalFromHexDigitAt", "longDecimalFromHexDigitAt", "throwInvalidNumberOfDigits", "specifier", "expected", "throwNotContainedAt", "throwInvalidPrefixSuffix", "throwInvalidDigitAt", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "kotlin-stdlib"}, k = 2, mv = {2, 2, 0}, xi = 48)
|
|
@SourceDebugExtension({"SMAP\nHexExtensions.kt\nKotlin\n*S Kotlin\n*F\n+ 1 HexExtensions.kt\nkotlin/text/HexExtensionsKt\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 _Strings.kt\nkotlin/text/StringsKt___StringsKt\n*L\n1#1,1237:1\n1186#1,7:1239\n1186#1,7:1246\n1186#1,7:1253\n1186#1,7:1260\n1186#1,7:1267\n1186#1,7:1274\n1186#1,7:1281\n1186#1,7:1288\n1197#1,5:1295\n1197#1,5:1300\n1186#1,7:1305\n1186#1,7:1312\n1197#1,5:1319\n1206#1,5:1324\n1#2:1238\n1188#3,3:1329\n1188#3,3:1332\n1188#3,3:1335\n1188#3,3:1338\n*S KotlinDebug\n*F\n+ 1 HexExtensions.kt\nkotlin/text/HexExtensionsKt\n*L\n450#1:1239,7\n482#1:1246,7\n486#1:1253,7\n489#1:1260,7\n529#1:1267,7\n532#1:1274,7\n537#1:1281,7\n542#1:1288,7\n549#1:1295,5\n550#1:1300,5\n1141#1:1305,7\n1143#1:1312,7\n1171#1:1319,5\n1179#1:1324,5\n42#1:1329,3\n43#1:1332,3\n54#1:1335,3\n55#1:1338,3\n*E\n"})
|
|
/* loaded from: classes4.dex */
|
|
public final class HexExtensionsKt {
|
|
|
|
@NotNull
|
|
private static final int[] BYTE_TO_LOWER_CASE_HEX_DIGITS;
|
|
|
|
@NotNull
|
|
private static final int[] BYTE_TO_UPPER_CASE_HEX_DIGITS;
|
|
|
|
@NotNull
|
|
private static final int[] HEX_DIGITS_TO_DECIMAL;
|
|
|
|
@NotNull
|
|
private static final long[] HEX_DIGITS_TO_LONG_DECIMAL;
|
|
|
|
@NotNull
|
|
private static final String LOWER_CASE_HEX_DIGITS = "0123456789abcdef";
|
|
|
|
@NotNull
|
|
private static final String UPPER_CASE_HEX_DIGITS = "0123456789ABCDEF";
|
|
|
|
static {
|
|
int[] iArr = new int[256];
|
|
int i = 0;
|
|
for (int i2 = 0; i2 < 256; i2++) {
|
|
iArr[i2] = LOWER_CASE_HEX_DIGITS.charAt(i2 & 15) | (LOWER_CASE_HEX_DIGITS.charAt(i2 >> 4) << '\b');
|
|
}
|
|
BYTE_TO_LOWER_CASE_HEX_DIGITS = iArr;
|
|
int[] iArr2 = new int[256];
|
|
for (int i3 = 0; i3 < 256; i3++) {
|
|
iArr2[i3] = UPPER_CASE_HEX_DIGITS.charAt(i3 & 15) | (UPPER_CASE_HEX_DIGITS.charAt(i3 >> 4) << '\b');
|
|
}
|
|
BYTE_TO_UPPER_CASE_HEX_DIGITS = iArr2;
|
|
int[] iArr3 = new int[256];
|
|
for (int i4 = 0; i4 < 256; i4++) {
|
|
iArr3[i4] = -1;
|
|
}
|
|
int i5 = 0;
|
|
int i6 = 0;
|
|
while (i5 < LOWER_CASE_HEX_DIGITS.length()) {
|
|
iArr3[LOWER_CASE_HEX_DIGITS.charAt(i5)] = i6;
|
|
i5++;
|
|
i6++;
|
|
}
|
|
int i7 = 0;
|
|
int i8 = 0;
|
|
while (i7 < UPPER_CASE_HEX_DIGITS.length()) {
|
|
iArr3[UPPER_CASE_HEX_DIGITS.charAt(i7)] = i8;
|
|
i7++;
|
|
i8++;
|
|
}
|
|
HEX_DIGITS_TO_DECIMAL = iArr3;
|
|
long[] jArr = new long[256];
|
|
for (int i9 = 0; i9 < 256; i9++) {
|
|
jArr[i9] = -1;
|
|
}
|
|
int i10 = 0;
|
|
int i11 = 0;
|
|
while (i10 < LOWER_CASE_HEX_DIGITS.length()) {
|
|
jArr[LOWER_CASE_HEX_DIGITS.charAt(i10)] = i11;
|
|
i10++;
|
|
i11++;
|
|
}
|
|
int i12 = 0;
|
|
while (i < UPPER_CASE_HEX_DIGITS.length()) {
|
|
jArr[UPPER_CASE_HEX_DIGITS.charAt(i)] = i12;
|
|
i++;
|
|
i12++;
|
|
}
|
|
HEX_DIGITS_TO_LONG_DECIMAL = jArr;
|
|
}
|
|
|
|
private static final long charsPerSet(long j, int i, int i2) {
|
|
if (i > 0) {
|
|
long j2 = i;
|
|
return ((j2 - 1) * i2) + (j * j2);
|
|
}
|
|
throw new IllegalArgumentException("Failed requirement.");
|
|
}
|
|
|
|
private static final int checkContainsAt(String str, int i, int i2, String str2, boolean z, String str3) {
|
|
if (str2.length() == 0) {
|
|
return i;
|
|
}
|
|
int length = str2.length();
|
|
for (int i3 = 0; i3 < length; i3++) {
|
|
if (!CharsKt__CharKt.equals(str2.charAt(i3), str.charAt(i + i3), z)) {
|
|
throwNotContainedAt(str, i, i2, str2, str3);
|
|
}
|
|
}
|
|
return str2.length() + i;
|
|
}
|
|
|
|
private static final int checkFormatLength(long j) {
|
|
if (0 <= j && j <= 2147483647L) {
|
|
return (int) j;
|
|
}
|
|
throw new IllegalArgumentException("The resulting string length is too big: " + ((Object) ULong.m250toStringimpl(ULong.m204constructorimpl(j))));
|
|
}
|
|
|
|
private static final int checkNewLineAt(String str, int i, int i2) {
|
|
if (str.charAt(i) == '\r') {
|
|
int i3 = i + 1;
|
|
if (i3 < i2 && str.charAt(i3) == '\n') {
|
|
return i + 2;
|
|
}
|
|
return i3;
|
|
}
|
|
if (str.charAt(i) == '\n') {
|
|
return i + 1;
|
|
}
|
|
StringBuilder s = android.support.v4.media.a.s(i, "Expected a new line at index ", ", but was ");
|
|
s.append(str.charAt(i));
|
|
throw new NumberFormatException(s.toString());
|
|
}
|
|
|
|
private static final void checkNumberOfDigits(String str, int i, int i2, int i3) {
|
|
int i4 = i2 - i;
|
|
if (i4 < 1) {
|
|
throwInvalidNumberOfDigits(str, i, i2, "at least", 1);
|
|
} else if (i4 > i3) {
|
|
checkZeroDigits(str, i, (i4 + i) - i3);
|
|
}
|
|
}
|
|
|
|
private static final void checkPrefixSuffixNumberOfDigits(String str, int i, int i2, String str2, String str3, boolean z, int i3) {
|
|
if ((i2 - i) - str2.length() <= str3.length()) {
|
|
throwInvalidPrefixSuffix(str, i, i2, str2, str3);
|
|
}
|
|
if (str2.length() != 0) {
|
|
int length = str2.length();
|
|
for (int i4 = 0; i4 < length; i4++) {
|
|
if (!CharsKt__CharKt.equals(str2.charAt(i4), str.charAt(i + i4), z)) {
|
|
throwNotContainedAt(str, i, i2, str2, "prefix");
|
|
}
|
|
}
|
|
i += str2.length();
|
|
}
|
|
int length2 = i2 - str3.length();
|
|
if (str3.length() != 0) {
|
|
int length3 = str3.length();
|
|
for (int i5 = 0; i5 < length3; i5++) {
|
|
if (!CharsKt__CharKt.equals(str3.charAt(i5), str.charAt(length2 + i5), z)) {
|
|
throwNotContainedAt(str, length2, i2, str3, "suffix");
|
|
}
|
|
}
|
|
}
|
|
checkNumberOfDigits(str, i, length2, i3);
|
|
}
|
|
|
|
private static final void checkZeroDigits(String str, int i, int i2) {
|
|
while (i < i2) {
|
|
if (str.charAt(i) == '0') {
|
|
i++;
|
|
} else {
|
|
StringBuilder s = android.support.v4.media.a.s(i, "Expected the hexadecimal digit '0' at index ", ", but was '");
|
|
s.append(str.charAt(i));
|
|
s.append("'.\nThe result won't fit the type being parsed.");
|
|
throw new NumberFormatException(s.toString());
|
|
}
|
|
}
|
|
}
|
|
|
|
private static final int decimalFromHexDigitAt(String str, int i) {
|
|
int i2;
|
|
char charAt = str.charAt(i);
|
|
if ((charAt >>> '\b') == 0 && (i2 = HEX_DIGITS_TO_DECIMAL[charAt]) >= 0) {
|
|
return i2;
|
|
}
|
|
throwInvalidDigitAt(str, i);
|
|
throw new KotlinNothingValueException();
|
|
}
|
|
|
|
private static final int formatByteAt(byte[] bArr, int i, String str, String str2, int[] iArr, char[] cArr, int i2) {
|
|
return toCharArrayIfNotEmpty(str2, cArr, formatByteAt(bArr, i, iArr, cArr, toCharArrayIfNotEmpty(str, cArr, i2)));
|
|
}
|
|
|
|
private static final int formattedStringLength(int i, int i2, int i3, int i4) {
|
|
if (i > 0) {
|
|
long j = i2;
|
|
return checkFormatLength((i * (((i3 + 2) + i4) + j)) - j);
|
|
}
|
|
throw new IllegalArgumentException("Failed requirement.");
|
|
}
|
|
|
|
@NotNull
|
|
public static final int[] getBYTE_TO_LOWER_CASE_HEX_DIGITS() {
|
|
return BYTE_TO_LOWER_CASE_HEX_DIGITS;
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
public static final byte hexToByte(@NotNull String str, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
return hexToByte(str, 0, str.length(), format);
|
|
}
|
|
|
|
public static /* synthetic */ byte hexToByte$default(String str, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToByte(str, hexFormat);
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
@NotNull
|
|
public static final byte[] hexToByteArray(@NotNull String str, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
return hexToByteArray(str, 0, str.length(), format);
|
|
}
|
|
|
|
public static /* synthetic */ byte[] hexToByteArray$default(String str, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToByteArray(str, hexFormat);
|
|
}
|
|
|
|
private static final byte[] hexToByteArrayNoLineAndGroupSeparator(String str, int i, int i2, HexFormat.BytesHexFormat bytesHexFormat) {
|
|
if (bytesHexFormat.getShortByteSeparatorNoPrefixAndSuffix()) {
|
|
return hexToByteArrayShortByteSeparatorNoPrefixAndSuffix(str, i, i2, bytesHexFormat);
|
|
}
|
|
return hexToByteArrayNoLineAndGroupSeparatorSlowPath(str, i, i2, bytesHexFormat);
|
|
}
|
|
|
|
private static final byte[] hexToByteArrayNoLineAndGroupSeparatorSlowPath(String str, int i, int i2, HexFormat.BytesHexFormat bytesHexFormat) {
|
|
String bytePrefix = bytesHexFormat.getBytePrefix();
|
|
String byteSuffix = bytesHexFormat.getByteSuffix();
|
|
String byteSeparator = bytesHexFormat.getByteSeparator();
|
|
long length = byteSeparator.length();
|
|
long length2 = bytePrefix.length() + 2 + byteSuffix.length() + length;
|
|
long j = i2 - i;
|
|
int i3 = (int) ((j + length) / length2);
|
|
if ((i3 * length2) - length != j) {
|
|
return null;
|
|
}
|
|
boolean ignoreCase = bytesHexFormat.getIgnoreCase();
|
|
byte[] bArr = new byte[i3];
|
|
if (bytePrefix.length() != 0) {
|
|
int length3 = bytePrefix.length();
|
|
for (int i4 = 0; i4 < length3; i4++) {
|
|
if (!CharsKt__CharKt.equals(bytePrefix.charAt(i4), str.charAt(i + i4), ignoreCase)) {
|
|
throwNotContainedAt(str, i, i2, bytePrefix, "byte prefix");
|
|
}
|
|
}
|
|
i += bytePrefix.length();
|
|
}
|
|
String D = android.support.v4.media.a.D(byteSuffix, byteSeparator, bytePrefix);
|
|
int i5 = i3 - 1;
|
|
for (int i6 = 0; i6 < i5; i6++) {
|
|
bArr[i6] = parseByteAt(str, i);
|
|
i += 2;
|
|
if (D.length() != 0) {
|
|
int length4 = D.length();
|
|
for (int i7 = 0; i7 < length4; i7++) {
|
|
if (!CharsKt__CharKt.equals(D.charAt(i7), str.charAt(i + i7), ignoreCase)) {
|
|
throwNotContainedAt(str, i, i2, D, "byte suffix + byte separator + byte prefix");
|
|
}
|
|
}
|
|
i = D.length() + i;
|
|
}
|
|
}
|
|
bArr[i5] = parseByteAt(str, i);
|
|
int i8 = i + 2;
|
|
if (byteSuffix.length() == 0) {
|
|
return bArr;
|
|
}
|
|
int length5 = byteSuffix.length();
|
|
for (int i9 = 0; i9 < length5; i9++) {
|
|
if (!CharsKt__CharKt.equals(byteSuffix.charAt(i9), str.charAt(i8 + i9), ignoreCase)) {
|
|
throwNotContainedAt(str, i8, i2, byteSuffix, "byte suffix");
|
|
}
|
|
}
|
|
return bArr;
|
|
}
|
|
|
|
private static final byte[] hexToByteArrayShortByteSeparatorNoPrefixAndSuffix(String str, int i, int i2, HexFormat.BytesHexFormat bytesHexFormat) {
|
|
int length = bytesHexFormat.getByteSeparator().length();
|
|
if (length <= 1) {
|
|
int i3 = i2 - i;
|
|
int i4 = 2;
|
|
if (length == 0) {
|
|
if ((i3 & 1) != 0) {
|
|
return null;
|
|
}
|
|
int i5 = i3 >> 1;
|
|
byte[] bArr = new byte[i5];
|
|
int i6 = 0;
|
|
for (int i7 = 0; i7 < i5; i7++) {
|
|
bArr[i7] = parseByteAt(str, i6);
|
|
i6 += 2;
|
|
}
|
|
return bArr;
|
|
}
|
|
if (i3 % 3 != 2) {
|
|
return null;
|
|
}
|
|
int i8 = (i3 / 3) + 1;
|
|
byte[] bArr2 = new byte[i8];
|
|
char charAt = bytesHexFormat.getByteSeparator().charAt(0);
|
|
bArr2[0] = parseByteAt(str, 0);
|
|
for (int i9 = 1; i9 < i8; i9++) {
|
|
if (str.charAt(i4) != charAt) {
|
|
String byteSeparator = bytesHexFormat.getByteSeparator();
|
|
boolean ignoreCase = bytesHexFormat.getIgnoreCase();
|
|
if (byteSeparator.length() != 0) {
|
|
int length2 = byteSeparator.length();
|
|
for (int i10 = 0; i10 < length2; i10++) {
|
|
if (!CharsKt__CharKt.equals(byteSeparator.charAt(i10), str.charAt(i4 + i10), ignoreCase)) {
|
|
throwNotContainedAt(str, i4, i2, byteSeparator, "byte separator");
|
|
}
|
|
}
|
|
byteSeparator.length();
|
|
}
|
|
}
|
|
bArr2[i9] = parseByteAt(str, i4 + 1);
|
|
i4 += 3;
|
|
}
|
|
return bArr2;
|
|
}
|
|
throw new IllegalArgumentException("Failed requirement.");
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:20:0x00f7 */
|
|
/* JADX WARN: Removed duplicated region for block: B:23:0x010d */
|
|
/* JADX WARN: Removed duplicated region for block: B:26:0x0110 */
|
|
/* JADX WARN: Removed duplicated region for block: B:8:0x00cb */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static final byte[] hexToByteArraySlowPath(java.lang.String r18, int r19, int r20, kotlin.text.HexFormat.BytesHexFormat r21) {
|
|
/*
|
|
Method dump skipped, instructions count: 336
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: kotlin.text.HexExtensionsKt.hexToByteArraySlowPath(java.lang.String, int, int, kotlin.text.HexFormat$BytesHexFormat):byte[]");
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
public static final int hexToInt(@NotNull String str, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
return hexToInt(str, 0, str.length(), format);
|
|
}
|
|
|
|
public static /* synthetic */ int hexToInt$default(String str, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToInt(str, hexFormat);
|
|
}
|
|
|
|
private static final int hexToIntImpl(String str, int i, int i2, HexFormat hexFormat, int i3) {
|
|
AbstractList.INSTANCE.checkBoundsIndexes$kotlin_stdlib(i, i2, str.length());
|
|
HexFormat.NumberHexFormat number = hexFormat.getNumber();
|
|
if (number.getIsDigitsOnly()) {
|
|
checkNumberOfDigits(str, i, i2, i3);
|
|
return parseInt(str, i, i2);
|
|
}
|
|
String prefix = number.getPrefix();
|
|
String suffix = number.getSuffix();
|
|
checkPrefixSuffixNumberOfDigits(str, i, i2, prefix, suffix, number.getIgnoreCase(), i3);
|
|
return parseInt(str, prefix.length() + i, i2 - suffix.length());
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
public static final long hexToLong(@NotNull String str, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
return hexToLong(str, 0, str.length(), format);
|
|
}
|
|
|
|
public static /* synthetic */ long hexToLong$default(String str, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToLong(str, hexFormat);
|
|
}
|
|
|
|
private static final long hexToLongImpl(String str, int i, int i2, HexFormat hexFormat, int i3) {
|
|
AbstractList.INSTANCE.checkBoundsIndexes$kotlin_stdlib(i, i2, str.length());
|
|
HexFormat.NumberHexFormat number = hexFormat.getNumber();
|
|
if (number.getIsDigitsOnly()) {
|
|
checkNumberOfDigits(str, i, i2, i3);
|
|
return parseLong(str, i, i2);
|
|
}
|
|
String prefix = number.getPrefix();
|
|
String suffix = number.getSuffix();
|
|
checkPrefixSuffixNumberOfDigits(str, i, i2, prefix, suffix, number.getIgnoreCase(), i3);
|
|
return parseLong(str, prefix.length() + i, i2 - suffix.length());
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
public static final short hexToShort(@NotNull String str, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
return hexToShort(str, 0, str.length(), format);
|
|
}
|
|
|
|
public static /* synthetic */ short hexToShort$default(String str, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToShort(str, hexFormat);
|
|
}
|
|
|
|
private static final long longDecimalFromHexDigitAt(String str, int i) {
|
|
char charAt = str.charAt(i);
|
|
if ((charAt >>> '\b') == 0) {
|
|
long j = HEX_DIGITS_TO_LONG_DECIMAL[charAt];
|
|
if (j >= 0) {
|
|
return j;
|
|
}
|
|
}
|
|
throwInvalidDigitAt(str, i);
|
|
throw new KotlinNothingValueException();
|
|
}
|
|
|
|
private static final byte parseByteAt(String str, int i) {
|
|
int[] iArr;
|
|
int i2;
|
|
int i3;
|
|
char charAt = str.charAt(i);
|
|
if ((charAt >>> '\b') == 0 && (i2 = (iArr = HEX_DIGITS_TO_DECIMAL)[charAt]) >= 0) {
|
|
int i4 = i + 1;
|
|
char charAt2 = str.charAt(i4);
|
|
if ((charAt2 >>> '\b') == 0 && (i3 = iArr[charAt2]) >= 0) {
|
|
return (byte) ((i2 << 4) | i3);
|
|
}
|
|
throwInvalidDigitAt(str, i4);
|
|
throw new KotlinNothingValueException();
|
|
}
|
|
throwInvalidDigitAt(str, i);
|
|
throw new KotlinNothingValueException();
|
|
}
|
|
|
|
private static final int parseInt(String str, int i, int i2) {
|
|
int i3;
|
|
int i4 = 0;
|
|
while (i < i2) {
|
|
int i5 = i4 << 4;
|
|
char charAt = str.charAt(i);
|
|
if ((charAt >>> '\b') == 0 && (i3 = HEX_DIGITS_TO_DECIMAL[charAt]) >= 0) {
|
|
i4 = i5 | i3;
|
|
i++;
|
|
} else {
|
|
throwInvalidDigitAt(str, i);
|
|
throw new KotlinNothingValueException();
|
|
}
|
|
}
|
|
return i4;
|
|
}
|
|
|
|
private static final long parseLong(String str, int i, int i2) {
|
|
long j = 0;
|
|
while (i < i2) {
|
|
long j2 = j << 4;
|
|
char charAt = str.charAt(i);
|
|
if ((charAt >>> '\b') == 0) {
|
|
long j3 = HEX_DIGITS_TO_LONG_DECIMAL[charAt];
|
|
if (j3 >= 0) {
|
|
j = j2 | j3;
|
|
i++;
|
|
}
|
|
}
|
|
throwInvalidDigitAt(str, i);
|
|
throw new KotlinNothingValueException();
|
|
}
|
|
return j;
|
|
}
|
|
|
|
public static final int parsedByteArrayMaxSize(int i, int i2, int i3, int i4, int i5, int i6, int i7) {
|
|
long charsPerSet;
|
|
int i8;
|
|
if (i > 0) {
|
|
long j = i6 + 2 + i7;
|
|
long charsPerSet2 = charsPerSet(j, i3, i5);
|
|
if (i2 <= i3) {
|
|
charsPerSet = charsPerSet(j, i2, i5);
|
|
} else {
|
|
charsPerSet = charsPerSet(charsPerSet2, i2 / i3, i4);
|
|
int i9 = i2 % i3;
|
|
if (i9 != 0) {
|
|
charsPerSet = charsPerSet + i4 + charsPerSet(j, i9, i5);
|
|
}
|
|
}
|
|
long j2 = i;
|
|
long wholeElementsPerSet = wholeElementsPerSet(j2, charsPerSet, 1);
|
|
long j3 = j2 - ((charsPerSet + 1) * wholeElementsPerSet);
|
|
long wholeElementsPerSet2 = wholeElementsPerSet(j3, charsPerSet2, i4);
|
|
long j4 = j3 - ((charsPerSet2 + i4) * wholeElementsPerSet2);
|
|
long wholeElementsPerSet3 = wholeElementsPerSet(j4, j, i5);
|
|
if (j4 - ((j + i5) * wholeElementsPerSet3) > 0) {
|
|
i8 = 1;
|
|
} else {
|
|
i8 = 0;
|
|
}
|
|
return (int) ((wholeElementsPerSet2 * i3) + (wholeElementsPerSet * i2) + wholeElementsPerSet3 + i8);
|
|
}
|
|
throw new IllegalArgumentException("Failed requirement.");
|
|
}
|
|
|
|
private static final Void throwInvalidDigitAt(String str, int i) {
|
|
StringBuilder s = android.support.v4.media.a.s(i, "Expected a hexadecimal digit at index ", ", but was ");
|
|
s.append(str.charAt(i));
|
|
throw new NumberFormatException(s.toString());
|
|
}
|
|
|
|
private static final void throwInvalidNumberOfDigits(String str, int i, int i2, String str2, int i3) {
|
|
Intrinsics.checkNotNull(str, "null cannot be cast to non-null type java.lang.String");
|
|
String substring = str.substring(i, i2);
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
throw new NumberFormatException("Expected " + str2 + ' ' + i3 + " hexadecimal digits at index " + i + ", but was \"" + substring + "\" of length " + (i2 - i));
|
|
}
|
|
|
|
private static final void throwInvalidPrefixSuffix(String str, int i, int i2, String str2, String str3) {
|
|
Intrinsics.checkNotNull(str, "null cannot be cast to non-null type java.lang.String");
|
|
String substring = str.substring(i, i2);
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
StringBuilder u = androidx.work.impl.workers.a.u("Expected a hexadecimal number with prefix \"", str2, "\" and suffix \"", str3, "\", but was ");
|
|
u.append(substring);
|
|
throw new NumberFormatException(u.toString());
|
|
}
|
|
|
|
private static final void throwNotContainedAt(String str, int i, int i2, String str2, String str3) {
|
|
int coerceAtMost = RangesKt.coerceAtMost(str2.length() + i, i2);
|
|
Intrinsics.checkNotNull(str, "null cannot be cast to non-null type java.lang.String");
|
|
String substring = str.substring(i, coerceAtMost);
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
StringBuilder u = androidx.work.impl.workers.a.u("Expected ", str3, " \"", str2, "\" at index ");
|
|
u.append(i);
|
|
u.append(", but was ");
|
|
u.append(substring);
|
|
throw new NumberFormatException(u.toString());
|
|
}
|
|
|
|
private static final int toCharArrayIfNotEmpty(String str, char[] cArr, int i) {
|
|
int length = str.length();
|
|
if (length != 0) {
|
|
if (length != 1) {
|
|
int length2 = str.length();
|
|
Intrinsics.checkNotNull(str, "null cannot be cast to non-null type java.lang.String");
|
|
str.getChars(0, length2, cArr, i);
|
|
} else {
|
|
cArr[i] = str.charAt(0);
|
|
}
|
|
}
|
|
return str.length() + i;
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
@NotNull
|
|
public static final String toHexString(@NotNull byte[] bArr, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(bArr, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
return toHexString(bArr, 0, bArr.length, format);
|
|
}
|
|
|
|
public static /* synthetic */ String toHexString$default(byte[] bArr, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return toHexString(bArr, hexFormat);
|
|
}
|
|
|
|
private static final String toHexStringImpl(long j, HexFormat.NumberHexFormat numberHexFormat, String str, int i) {
|
|
if ((i & 3) == 0) {
|
|
int i2 = i >> 2;
|
|
int minLength = numberHexFormat.getMinLength();
|
|
int coerceAtLeast = RangesKt.coerceAtLeast(minLength - i2, 0);
|
|
String prefix = numberHexFormat.getPrefix();
|
|
String suffix = numberHexFormat.getSuffix();
|
|
boolean removeLeadingZeros = numberHexFormat.getRemoveLeadingZeros();
|
|
int checkFormatLength = checkFormatLength(prefix.length() + coerceAtLeast + i2 + suffix.length());
|
|
char[] cArr = new char[checkFormatLength];
|
|
int charArrayIfNotEmpty = toCharArrayIfNotEmpty(prefix, cArr, 0);
|
|
if (coerceAtLeast > 0) {
|
|
int i3 = coerceAtLeast + charArrayIfNotEmpty;
|
|
ArraysKt.fill(cArr, str.charAt(0), charArrayIfNotEmpty, i3);
|
|
charArrayIfNotEmpty = i3;
|
|
}
|
|
int i4 = i;
|
|
for (int i5 = 0; i5 < i2; i5++) {
|
|
i4 -= 4;
|
|
int i6 = (int) ((j >> i4) & 15);
|
|
if (removeLeadingZeros && i6 == 0 && (i4 >> 2) >= minLength) {
|
|
removeLeadingZeros = true;
|
|
} else {
|
|
removeLeadingZeros = false;
|
|
}
|
|
if (!removeLeadingZeros) {
|
|
cArr[charArrayIfNotEmpty] = str.charAt(i6);
|
|
charArrayIfNotEmpty++;
|
|
}
|
|
}
|
|
int charArrayIfNotEmpty2 = toCharArrayIfNotEmpty(suffix, cArr, charArrayIfNotEmpty);
|
|
if (charArrayIfNotEmpty2 == checkFormatLength) {
|
|
return StringsKt__StringsJVMKt.concatToString(cArr);
|
|
}
|
|
return StringsKt__StringsJVMKt.concatToString$default(cArr, 0, charArrayIfNotEmpty2, 1, null);
|
|
}
|
|
throw new IllegalArgumentException("Failed requirement.");
|
|
}
|
|
|
|
private static final String toHexStringNoLineAndGroupSeparator(byte[] bArr, int i, int i2, HexFormat.BytesHexFormat bytesHexFormat, int[] iArr) {
|
|
if (bytesHexFormat.getShortByteSeparatorNoPrefixAndSuffix()) {
|
|
return toHexStringShortByteSeparatorNoPrefixAndSuffix(bArr, i, i2, bytesHexFormat, iArr);
|
|
}
|
|
return toHexStringNoLineAndGroupSeparatorSlowPath(bArr, i, i2, bytesHexFormat, iArr);
|
|
}
|
|
|
|
private static final String toHexStringNoLineAndGroupSeparatorSlowPath(byte[] bArr, int i, int i2, HexFormat.BytesHexFormat bytesHexFormat, int[] iArr) {
|
|
String bytePrefix = bytesHexFormat.getBytePrefix();
|
|
String byteSuffix = bytesHexFormat.getByteSuffix();
|
|
String byteSeparator = bytesHexFormat.getByteSeparator();
|
|
char[] cArr = new char[formattedStringLength(i2 - i, byteSeparator.length(), bytePrefix.length(), byteSuffix.length())];
|
|
int formatByteAt = formatByteAt(bArr, i, bytePrefix, byteSuffix, iArr, cArr, 0);
|
|
for (int i3 = i + 1; i3 < i2; i3++) {
|
|
formatByteAt = formatByteAt(bArr, i3, bytePrefix, byteSuffix, iArr, cArr, toCharArrayIfNotEmpty(byteSeparator, cArr, formatByteAt));
|
|
}
|
|
return StringsKt__StringsJVMKt.concatToString(cArr);
|
|
}
|
|
|
|
private static final String toHexStringShortByteSeparatorNoPrefixAndSuffix(byte[] bArr, int i, int i2, HexFormat.BytesHexFormat bytesHexFormat, int[] iArr) {
|
|
int length = bytesHexFormat.getByteSeparator().length();
|
|
if (length <= 1) {
|
|
int i3 = i2 - i;
|
|
int i4 = 0;
|
|
if (length == 0) {
|
|
char[] cArr = new char[checkFormatLength(i3 * 2)];
|
|
while (i < i2) {
|
|
i4 = formatByteAt(bArr, i, iArr, cArr, i4);
|
|
i++;
|
|
}
|
|
return StringsKt__StringsJVMKt.concatToString(cArr);
|
|
}
|
|
char[] cArr2 = new char[checkFormatLength((i3 * 3) - 1)];
|
|
char charAt = bytesHexFormat.getByteSeparator().charAt(0);
|
|
int formatByteAt = formatByteAt(bArr, i, iArr, cArr2, 0);
|
|
for (int i5 = i + 1; i5 < i2; i5++) {
|
|
cArr2[formatByteAt] = charAt;
|
|
formatByteAt = formatByteAt(bArr, i5, iArr, cArr2, formatByteAt + 1);
|
|
}
|
|
return StringsKt__StringsJVMKt.concatToString(cArr2);
|
|
}
|
|
throw new IllegalArgumentException("Failed requirement.");
|
|
}
|
|
|
|
private static final String toHexStringSlowPath(byte[] bArr, int i, int i2, HexFormat.BytesHexFormat bytesHexFormat, int[] iArr) {
|
|
int i3;
|
|
int i4;
|
|
int bytesPerLine = bytesHexFormat.getBytesPerLine();
|
|
int bytesPerGroup = bytesHexFormat.getBytesPerGroup();
|
|
String bytePrefix = bytesHexFormat.getBytePrefix();
|
|
String byteSuffix = bytesHexFormat.getByteSuffix();
|
|
String byteSeparator = bytesHexFormat.getByteSeparator();
|
|
String groupSeparator = bytesHexFormat.getGroupSeparator();
|
|
int formattedStringLength = formattedStringLength(i2 - i, bytesPerLine, bytesPerGroup, groupSeparator.length(), byteSeparator.length(), bytePrefix.length(), byteSuffix.length());
|
|
char[] cArr = new char[formattedStringLength];
|
|
int i5 = i;
|
|
int i6 = 0;
|
|
int i7 = 0;
|
|
int i8 = 0;
|
|
while (i5 < i2) {
|
|
if (i7 == bytesPerLine) {
|
|
cArr[i6] = '\n';
|
|
i6++;
|
|
i3 = 0;
|
|
i4 = 0;
|
|
} else if (i8 == bytesPerGroup) {
|
|
i6 = toCharArrayIfNotEmpty(groupSeparator, cArr, i6);
|
|
i3 = i7;
|
|
i4 = 0;
|
|
} else {
|
|
i3 = i7;
|
|
i4 = i8;
|
|
}
|
|
if (i4 != 0) {
|
|
i6 = toCharArrayIfNotEmpty(byteSeparator, cArr, i6);
|
|
}
|
|
String str = bytePrefix;
|
|
int formatByteAt = formatByteAt(bArr, i5, str, byteSuffix, iArr, cArr, i6);
|
|
i5++;
|
|
i8 = i4 + 1;
|
|
i6 = formatByteAt;
|
|
bytePrefix = str;
|
|
i7 = i3 + 1;
|
|
}
|
|
if (i6 == formattedStringLength) {
|
|
return StringsKt__StringsJVMKt.concatToString(cArr);
|
|
}
|
|
throw new IllegalStateException("Check failed.");
|
|
}
|
|
|
|
private static final long wholeElementsPerSet(long j, long j2, int i) {
|
|
if (j <= 0 || j2 <= 0) {
|
|
return 0L;
|
|
}
|
|
long j3 = i;
|
|
return (j + j3) / (j2 + j3);
|
|
}
|
|
|
|
private static final byte hexToByte(String str, int i, int i2, HexFormat hexFormat) {
|
|
return (byte) hexToIntImpl(str, i, i2, hexFormat, 2);
|
|
}
|
|
|
|
public static /* synthetic */ byte hexToByte$default(String str, int i, int i2, HexFormat hexFormat, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = str.length();
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToByte(str, i, i2, hexFormat);
|
|
}
|
|
|
|
private static final byte[] hexToByteArray(String str, int i, int i2, HexFormat hexFormat) {
|
|
byte[] hexToByteArrayNoLineAndGroupSeparator;
|
|
AbstractList.INSTANCE.checkBoundsIndexes$kotlin_stdlib(i, i2, str.length());
|
|
if (i == i2) {
|
|
return new byte[0];
|
|
}
|
|
HexFormat.BytesHexFormat bytes = hexFormat.getBytes();
|
|
return (!bytes.getNoLineAndGroupSeparator() || (hexToByteArrayNoLineAndGroupSeparator = hexToByteArrayNoLineAndGroupSeparator(str, i, i2, bytes)) == null) ? hexToByteArraySlowPath(str, i, i2, bytes) : hexToByteArrayNoLineAndGroupSeparator;
|
|
}
|
|
|
|
public static /* synthetic */ byte[] hexToByteArray$default(String str, int i, int i2, HexFormat hexFormat, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = str.length();
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToByteArray(str, i, i2, hexFormat);
|
|
}
|
|
|
|
public static final int hexToInt(@NotNull String str, int i, int i2, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
return hexToIntImpl(str, i, i2, format, 8);
|
|
}
|
|
|
|
public static /* synthetic */ int hexToInt$default(String str, int i, int i2, HexFormat hexFormat, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = str.length();
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToInt(str, i, i2, hexFormat);
|
|
}
|
|
|
|
public static final long hexToLong(@NotNull String str, int i, int i2, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(str, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
return hexToLongImpl(str, i, i2, format, 16);
|
|
}
|
|
|
|
public static /* synthetic */ long hexToLong$default(String str, int i, int i2, HexFormat hexFormat, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = str.length();
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToLong(str, i, i2, hexFormat);
|
|
}
|
|
|
|
private static final short hexToShort(String str, int i, int i2, HexFormat hexFormat) {
|
|
return (short) hexToIntImpl(str, i, i2, hexFormat, 4);
|
|
}
|
|
|
|
public static /* synthetic */ short hexToShort$default(String str, int i, int i2, HexFormat hexFormat, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = str.length();
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return hexToShort(str, i, i2, hexFormat);
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
@NotNull
|
|
public static final String toHexString(@NotNull byte[] bArr, int i, int i2, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(bArr, "<this>");
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
AbstractList.INSTANCE.checkBoundsIndexes$kotlin_stdlib(i, i2, bArr.length);
|
|
if (i == i2) {
|
|
return RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
|
|
}
|
|
int[] iArr = format.getUpperCase() ? BYTE_TO_UPPER_CASE_HEX_DIGITS : BYTE_TO_LOWER_CASE_HEX_DIGITS;
|
|
HexFormat.BytesHexFormat bytes = format.getBytes();
|
|
if (bytes.getNoLineAndGroupSeparator()) {
|
|
return toHexStringNoLineAndGroupSeparator(bArr, i, i2, bytes, iArr);
|
|
}
|
|
return toHexStringSlowPath(bArr, i, i2, bytes, iArr);
|
|
}
|
|
|
|
public static /* synthetic */ String toHexString$default(byte[] bArr, int i, int i2, HexFormat hexFormat, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = 0;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = bArr.length;
|
|
}
|
|
if ((i3 & 4) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return toHexString(bArr, i, i2, hexFormat);
|
|
}
|
|
|
|
public static final int formattedStringLength(int i, int i2, int i3, int i4, int i5, int i6, int i7) {
|
|
if (i > 0) {
|
|
int i8 = i - 1;
|
|
int i9 = i8 / i2;
|
|
int i10 = (i2 - 1) / i3;
|
|
int i11 = i % i2;
|
|
if (i11 != 0) {
|
|
i2 = i11;
|
|
}
|
|
int i12 = (i10 * i9) + ((i2 - 1) / i3);
|
|
return checkFormatLength(((i6 + 2 + i7) * i) + (((i8 - i9) - i12) * i5) + (i12 * i4) + i9);
|
|
}
|
|
throw new IllegalArgumentException("Failed requirement.");
|
|
}
|
|
|
|
private static final int formatByteAt(byte[] bArr, int i, int[] iArr, char[] cArr, int i2) {
|
|
int i3 = iArr[bArr[i] & UByte.MAX_VALUE];
|
|
cArr[i2] = (char) (i3 >> 8);
|
|
cArr[i2 + 1] = (char) (i3 & KotlinVersion.MAX_COMPONENT_VALUE);
|
|
return i2 + 2;
|
|
}
|
|
|
|
public static /* synthetic */ String toHexString$default(byte b, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return toHexString(b, hexFormat);
|
|
}
|
|
|
|
public static /* synthetic */ String toHexString$default(short s, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return toHexString(s, hexFormat);
|
|
}
|
|
|
|
public static /* synthetic */ String toHexString$default(int i, HexFormat hexFormat, int i2, Object obj) {
|
|
if ((i2 & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return toHexString(i, hexFormat);
|
|
}
|
|
|
|
public static /* synthetic */ String toHexString$default(long j, HexFormat hexFormat, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
hexFormat = HexFormat.INSTANCE.getDefault();
|
|
}
|
|
return toHexString(j, hexFormat);
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
@NotNull
|
|
public static final String toHexString(byte b, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
String str = format.getUpperCase() ? UPPER_CASE_HEX_DIGITS : LOWER_CASE_HEX_DIGITS;
|
|
HexFormat.NumberHexFormat number = format.getNumber();
|
|
if (number.getIsDigitsOnlyAndNoPadding()) {
|
|
char[] cArr = {str.charAt((b >> 4) & 15), str.charAt(b & 15)};
|
|
if (number.getRemoveLeadingZeros()) {
|
|
return StringsKt__StringsJVMKt.concatToString$default(cArr, RangesKt.coerceAtMost((Integer.numberOfLeadingZeros(b & UByte.MAX_VALUE) - 24) >> 2, 1), 0, 2, null);
|
|
}
|
|
return StringsKt__StringsJVMKt.concatToString(cArr);
|
|
}
|
|
return toHexStringImpl(b, number, str, 8);
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
@NotNull
|
|
public static final String toHexString(short s, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
String str = format.getUpperCase() ? UPPER_CASE_HEX_DIGITS : LOWER_CASE_HEX_DIGITS;
|
|
HexFormat.NumberHexFormat number = format.getNumber();
|
|
if (number.getIsDigitsOnlyAndNoPadding()) {
|
|
char[] cArr = {str.charAt((s >> 12) & 15), str.charAt((s >> 8) & 15), str.charAt((s >> 4) & 15), str.charAt(s & 15)};
|
|
if (number.getRemoveLeadingZeros()) {
|
|
return StringsKt__StringsJVMKt.concatToString$default(cArr, RangesKt.coerceAtMost((Integer.numberOfLeadingZeros(s & UShort.MAX_VALUE) - 16) >> 2, 3), 0, 2, null);
|
|
}
|
|
return StringsKt__StringsJVMKt.concatToString(cArr);
|
|
}
|
|
return toHexStringImpl(s, number, str, 16);
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
@NotNull
|
|
public static final String toHexString(int i, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
String str = format.getUpperCase() ? UPPER_CASE_HEX_DIGITS : LOWER_CASE_HEX_DIGITS;
|
|
HexFormat.NumberHexFormat number = format.getNumber();
|
|
if (number.getIsDigitsOnlyAndNoPadding()) {
|
|
char[] cArr = {str.charAt((i >> 28) & 15), str.charAt((i >> 24) & 15), str.charAt((i >> 20) & 15), str.charAt((i >> 16) & 15), str.charAt((i >> 12) & 15), str.charAt((i >> 8) & 15), str.charAt((i >> 4) & 15), str.charAt(i & 15)};
|
|
if (number.getRemoveLeadingZeros()) {
|
|
return StringsKt__StringsJVMKt.concatToString$default(cArr, RangesKt.coerceAtMost(Integer.numberOfLeadingZeros(i) >> 2, 7), 0, 2, null);
|
|
}
|
|
return StringsKt__StringsJVMKt.concatToString(cArr);
|
|
}
|
|
return toHexStringImpl(i, number, str, 32);
|
|
}
|
|
|
|
@SinceKotlin(version = "2.2")
|
|
@WasExperimental(markerClass = {ExperimentalStdlibApi.class})
|
|
@NotNull
|
|
public static final String toHexString(long j, @NotNull HexFormat format) {
|
|
Intrinsics.checkNotNullParameter(format, "format");
|
|
String str = format.getUpperCase() ? UPPER_CASE_HEX_DIGITS : LOWER_CASE_HEX_DIGITS;
|
|
HexFormat.NumberHexFormat number = format.getNumber();
|
|
if (number.getIsDigitsOnlyAndNoPadding()) {
|
|
char[] cArr = {str.charAt((int) ((j >> 60) & 15)), str.charAt((int) ((j >> 56) & 15)), str.charAt((int) ((j >> 52) & 15)), str.charAt((int) ((j >> 48) & 15)), str.charAt((int) ((j >> 44) & 15)), str.charAt((int) ((j >> 40) & 15)), str.charAt((int) ((j >> 36) & 15)), str.charAt((int) ((j >> 32) & 15)), str.charAt((int) ((j >> 28) & 15)), str.charAt((int) ((j >> 24) & 15)), str.charAt((int) ((j >> 20) & 15)), str.charAt((int) ((j >> 16) & 15)), str.charAt((int) ((j >> 12) & 15)), str.charAt((int) ((j >> 8) & 15)), str.charAt((int) ((j >> 4) & 15)), str.charAt((int) (j & 15))};
|
|
if (number.getRemoveLeadingZeros()) {
|
|
return StringsKt__StringsJVMKt.concatToString$default(cArr, RangesKt.coerceAtMost(Long.numberOfLeadingZeros(j) >> 2, 15), 0, 2, null);
|
|
}
|
|
return StringsKt__StringsJVMKt.concatToString(cArr);
|
|
}
|
|
return toHexStringImpl(j, number, str, 64);
|
|
}
|
|
}
|