[JS IR BE] Fix stdlib files list for 1.3
This commit is contained in:
@@ -23,6 +23,7 @@ private val runtimeSources = listOfKtFilesFrom(
|
||||
"libraries/stdlib/js/src/generated",
|
||||
"libraries/stdlib/js/irRuntime",
|
||||
"libraries/stdlib/js/runtime",
|
||||
"libraries/stdlib/unsigned",
|
||||
|
||||
"core/builtins/native/kotlin/Annotation.kt",
|
||||
"core/builtins/native/kotlin/Number.kt",
|
||||
@@ -33,6 +34,12 @@ private val runtimeSources = listOfKtFilesFrom(
|
||||
|
||||
BasicBoxTest.COMMON_FILES_DIR_PATH
|
||||
) - listOfKtFilesFrom(
|
||||
"libraries/stdlib/common/src/kotlin/JvmAnnotationsH.kt",
|
||||
"libraries/stdlib/src/kotlin/annotations/Multiplatform.kt",
|
||||
|
||||
// TODO: Support Int.pow
|
||||
"libraries/stdlib/js/src/kotlin/random/PlatformRandom.kt",
|
||||
|
||||
// TODO: Unify exceptions
|
||||
"libraries/stdlib/common/src/kotlin/ExceptionsH.kt",
|
||||
|
||||
@@ -111,13 +118,14 @@ private val smallerRuntimeSources = listOfKtFilesFrom(
|
||||
|
||||
"libraries/stdlib/common/src/kotlin/JsAnnotationsH.kt",
|
||||
|
||||
"libraries/stdlib/common/src/kotlin/CoroutinesH.kt",
|
||||
"libraries/stdlib/common/src/kotlin/CoroutinesIntrinsicsH.kt",
|
||||
"libraries/stdlib/common/src/kotlin/CoroutinesExperimentalH.kt",
|
||||
"libraries/stdlib/common/src/kotlin/CoroutinesIntrinsicsExperimentalH.kt",
|
||||
|
||||
"libraries/stdlib/js/irRuntime",
|
||||
BasicBoxTest.COMMON_FILES_DIR_PATH
|
||||
) - listOfKtFilesFrom(
|
||||
"libraries/stdlib/js/irRuntime/kotlinHacks.kt"
|
||||
"libraries/stdlib/js/irRuntime/kotlinHacks.kt",
|
||||
"libraries/stdlib/js/irRuntime/PlatformRandom.kt"
|
||||
)
|
||||
|
||||
private var runtimeResult: Result? = null
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.random
|
||||
|
||||
import kotlin.math.pow
|
||||
|
||||
// TODO: use stdlib file when math.pow is fixed
|
||||
|
||||
internal actual fun defaultPlatformRandom(): Random =
|
||||
Random(js("(Math.random() * Math.pow(2, 32)) | 0").unsafeCast<Int>())
|
||||
|
||||
|
||||
internal actual fun fastLog2(value: Int): Int {
|
||||
// TODO: not so fast, make faster
|
||||
var v = value
|
||||
var log = -1
|
||||
while (v != 0) {
|
||||
v = v.ushr(1)
|
||||
log++
|
||||
}
|
||||
return log
|
||||
}
|
||||
|
||||
internal actual fun doubleFromParts(hi26: Int, low27: Int): Double =
|
||||
hi26 * (2.0.pow(-26)) + low27 * (2.0.pow(-53))
|
||||
Reference in New Issue
Block a user