switch to signed-first approach
All checks were successful
/ test (pull_request) Successful in 2m47s

It turns out signed math is more performant
This commit is contained in:
2026-01-15 14:10:14 +01:00
parent d06e523914
commit ff0e17b5ad
35 changed files with 862 additions and 826 deletions

View File

@@ -3,14 +3,8 @@ 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) }
fun UInt.toUByteArray(order: ByteOrder = BIG_ENDIAN) =
UByteArray(4).also { copyInto(it, order = order) }