Use common implementation of fastLog2 based on countLeadingZeroBits

This commit is contained in:
Ilya Gorbunov
2019-06-20 20:56:56 +03:00
parent f8724654a1
commit 39bdf34b9f
3 changed files with 3 additions and 15 deletions
@@ -28,9 +28,6 @@ public fun java.util.Random.asKotlinRandom(): Random =
internal actual inline fun defaultPlatformRandom(): Random =
IMPLEMENTATIONS.defaultPlatformRandom()
internal actual fun fastLog2(value: Int): Int =
31 - Integer.numberOfLeadingZeros(value)
internal actual fun doubleFromParts(hi26: Int, low27: Int): Double =
(hi26.toLong().shl(27) + low27) / (1L shl 53).toDouble()