diff --git a/ktoml-core/build.gradle.kts b/ktoml-core/build.gradle.kts index a96770be..bca8d27b 100644 --- a/ktoml-core/build.gradle.kts +++ b/ktoml-core/build.gradle.kts @@ -28,6 +28,7 @@ kotlin { macosX64() macosArm64() ios() + iosSimulatorArm64() sourceSets { all { diff --git a/ktoml-core/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/utils/UtilsSimulator.kt b/ktoml-core/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/utils/UtilsSimulator.kt new file mode 100644 index 00000000..458f07f2 --- /dev/null +++ b/ktoml-core/src/iosSimulatorArm64Main/kotlin/com/akuleshov7/ktoml/utils/UtilsSimulator.kt @@ -0,0 +1,15 @@ +/** + * Specific implementation for utilities + */ + +package com.akuleshov7.ktoml.utils + +@Suppress("MAGIC_NUMBER") +internal actual fun StringBuilder.appendCodePointCompat(codePoint: Int): StringBuilder = when (codePoint) { + in 0 until Char.MIN_SUPPLEMENTARY_CODE_POINT -> append(codePoint.toChar()) + in Char.MIN_SUPPLEMENTARY_CODE_POINT..Char.MAX_CODE_POINT -> { + append(Char.MIN_HIGH_SURROGATE + ((codePoint - 0x10000) shr 10)) + append(Char.MIN_LOW_SURROGATE + (codePoint and 0x3ff)) + } + else -> throw IllegalArgumentException() +}