nativeMain.kotlinx.io.core.ByteOrderNative.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-io-linuxx64 Show documentation
Show all versions of kotlinx-io-linuxx64 Show documentation
IO support libraries for Kotlin
package kotlinx.io.core
import kotlinx.cinterop.*
actual enum class ByteOrder {
BIG_ENDIAN, LITTLE_ENDIAN;
actual companion object {
private val native: ByteOrder
init {
native = memScoped {
val i = alloc()
i.value = 1
val bytes = i.reinterpret()
if (bytes.value == 0.toByte()) BIG_ENDIAN else LITTLE_ENDIAN
}
}
actual fun nativeOrder(): ByteOrder = native
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy