11 lines
359 B
Kotlin
11 lines
359 B
Kotlin
package com.infendro.bytes.uint
|
|
|
|
import com.infendro.bytes.ByteOrder
|
|
import com.infendro.bytes.ByteOrder.BIG_ENDIAN
|
|
|
|
fun UInt.toByteArray(order: ByteOrder = BIG_ENDIAN): ByteArray =
|
|
ByteArray(4).also { copyInto(it, order = order) }
|
|
|
|
fun UInt.toUByteArray(order: ByteOrder = BIG_ENDIAN): UByteArray =
|
|
UByteArray(4).also { copyInto(it, order = order) }
|