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.int
import com.infendro.bytes.ByteOrder
import com.infendro.bytes.ByteOrder.BIG_ENDIAN
fun Int.toUByteArray(order: ByteOrder = BIG_ENDIAN) =
UByteArray(4).also { copyInto(it, order = order) }
fun Int.toByteArray(order: ByteOrder = BIG_ENDIAN) =
ByteArray(4).also { copyInto(it, order = order) }
fun IntArray.toUByteArray(order: ByteOrder = BIG_ENDIAN) =
UByteArray(size * 4).also { copyInto(it, order = order) }
fun IntArray.toByteArray(order: ByteOrder = BIG_ENDIAN) =
ByteArray(size * 4).also { copyInto(it, order = order) }