jvmMain.kotlinx.io.bits.ByteOrderJVM.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-io-jvm Show documentation
Show all versions of kotlinx-io-jvm Show documentation
IO support libraries for Kotlin
package kotlinx.io.bits
/**
* Reverse number's byte order
*/
@Suppress("NOTHING_TO_INLINE")
actual inline fun Short.reverseByteOrder(): Short = java.lang.Short.reverseBytes(this)
/**
* Reverse number's byte order
*/
@Suppress("NOTHING_TO_INLINE")
actual inline fun Int.reverseByteOrder(): Int = java.lang.Integer.reverseBytes(this)
/**
* Reverse number's byte order
*/
@Suppress("NOTHING_TO_INLINE")
actual inline fun Long.reverseByteOrder(): Long = java.lang.Long.reverseBytes(this)
/**
* Reverse number's byte order
*/
@Suppress("NOTHING_TO_INLINE")
actual inline fun Float.reverseByteOrder(): Float =
java.lang.Float.intBitsToFloat(
java.lang.Integer.reverseBytes(
java.lang.Float.floatToRawIntBits(this)
)
)
/**
* Reverse number's byte order
*/
@Suppress("NOTHING_TO_INLINE")
actual inline fun Double.reverseByteOrder(): Double =
java.lang.Double.longBitsToDouble(
java.lang.Long.reverseBytes(
java.lang.Double.doubleToRawLongBits(this)
)
)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy