diff --git a/gradle.properties b/gradle.properties index 117839da546..37f87e0b77b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,6 @@ remoteRoot=konan_tests testDataVersion=1226829:id kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_13M2_CompilerAllPlugins),number:1.3-M2-release-211,tag:kotlin-native,pinned:true,branch:(default:any)/artifacts/content/maven kotlinVersion=1.3-M2-release-211 -testKotlinVersion=1.3-M2-release-203 +testKotlinVersion=1.3-M2-release-214 konanVersion=0.9 org.gradle.jvmargs='-Dfile.encoding=UTF-8' diff --git a/runtime/src/main/kotlin/kotlin/random/Random.kt b/runtime/src/main/kotlin/kotlin/random/Random.kt index 4f9abdd104f..7b6b7f13d96 100644 --- a/runtime/src/main/kotlin/kotlin/random/Random.kt +++ b/runtime/src/main/kotlin/kotlin/random/Random.kt @@ -59,14 +59,18 @@ public abstract class NativeRandom { */ override fun nextLong(): Long = (nextInt().toLong() shl 32) + nextInt().toLong() - override fun nextBits(bitCount: Int): Int = TODO("unimplemented") + override fun nextBits(bitCount: Int): Int = + nextInt().takeUpperBits(bitCount) } } - internal actual fun defaultPlatformRandom(): Random = NativeRandom -internal actual fun fastLog2(value: Int): Int = TODO("unimplemented") -internal actual fun doubleFromParts(hi26: Int, low27: Int): Double = TODO("unimplemented") + +internal actual fun fastLog2(value: Int): Int = + 31 - value.numberOfLeadingZeros() + +internal actual fun doubleFromParts(hi26: Int, low27: Int): Double = + (hi26.toLong().shl(27) + low27) / (1L shl 53).toDouble() // TODO: common stdlib Random hasn't got seed, this is workaround for running K/N tests. var Random.seed:Long