Interop, backend: add bitsTo{Float,Double} intrinsics
This commit is contained in:
committed by
SvyatoslavScherbina
parent
9afd9360b3
commit
01dd86d3b5
@@ -1,4 +1,7 @@
|
||||
package kotlinx.cinterop
|
||||
|
||||
internal fun decodeFromUtf8(bytes: ByteArray) = String(bytes)
|
||||
internal fun encodeToUtf8(str: String) = str.toByteArray()
|
||||
internal fun encodeToUtf8(str: String) = str.toByteArray()
|
||||
|
||||
fun bitsToFloat(bits: Int): Float = java.lang.Float.intBitsToFloat(bits)
|
||||
fun bitsToDouble(bits: Long): Double = java.lang.Double.longBitsToDouble(bits)
|
||||
@@ -1,5 +1,7 @@
|
||||
package kotlinx.cinterop
|
||||
|
||||
import konan.internal.Intrinsic
|
||||
|
||||
internal fun decodeFromUtf8(bytes: ByteArray): String = kotlin.text.fromUtf8Array(bytes, 0, bytes.size)
|
||||
|
||||
fun encodeToUtf8(str: String): ByteArray {
|
||||
@@ -13,4 +15,10 @@ fun encodeToUtf8(str: String): ByteArray {
|
||||
result[index] = char.toByte()
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@Intrinsic
|
||||
external fun bitsToFloat(bits: Int): Float
|
||||
|
||||
@Intrinsic
|
||||
external fun bitsToDouble(bits: Long): Double
|
||||
Reference in New Issue
Block a user