implement optimizations

This commit is contained in:
2026-01-14 15:36:50 +01:00
parent 9391009403
commit cc9961084c
31 changed files with 1025 additions and 1037 deletions

View File

@@ -0,0 +1,16 @@
package com.infendro.bytes.uint
import com.infendro.bytes.ByteOrder
import com.infendro.bytes.ByteOrder.BIG_ENDIAN
fun UInt.toUByteArray(order: ByteOrder = BIG_ENDIAN) =
UByteArray(4).also { copyInto(it, order = order) }
fun UInt.toByteArray(order: ByteOrder = BIG_ENDIAN) =
ByteArray(4).also { copyInto(it, order = order) }
fun UIntArray.toUByteArray(order: ByteOrder = BIG_ENDIAN) =
UByteArray(size * 4).also { copyInto(it, order = order) }
fun UIntArray.toByteArray(order: ByteOrder = BIG_ENDIAN) =
ByteArray(size * 4).also { copyInto(it, order = order) }