remove unsigned support

This commit is contained in:
Infendro committed 2026-02-05 14:19:51 +01:00
1 parent 421beeed1e
commit 03ec68cc40
36 files changed
+286 -874

No files matched your search

@@ -3,8 +3,8 @@ package com.infendro.bytes.int
import com.infendro.bytes.ByteOrder
import com.infendro.bytes.ByteOrder.BIG_ENDIAN
fun Int.toByteArray(order: ByteOrder = BIG_ENDIAN): ByteArray =
ByteArray(4).also { copyInto(it, order = order) }
fun Int.toUByteArray(order: ByteOrder = BIG_ENDIAN): UByteArray =
UByteArray(4).also { copyInto(it, order = order) }
fun Int.toByteArray(order: ByteOrder = BIG_ENDIAN): ByteArray {
val result = ByteArray(4)
copyInto(result, order = order)
return result
}
@@ -4,11 +4,7 @@ import com.infendro.bytes.ByteOrder
import com.infendro.bytes.ByteOrder.BIG_ENDIAN
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
fun Int.copyInto(
destination: ByteArray,
destinationOffset: Int = 0,
order: ByteOrder = BIG_ENDIAN,
) {
fun Int.copyInto(destination: ByteArray, destinationOffset: Int = 0, order: ByteOrder = BIG_ENDIAN) {
require(destinationOffset in 0..(destination.size - 4))
when (order) {
@@ -26,9 +22,3 @@ fun Int.copyInto(
}
}
}
fun Int.copyInto(
destination: UByteArray,
destinationOffset: Int = 0,
order: ByteOrder = BIG_ENDIAN,
) = copyInto(destination.asByteArray(), destinationOffset, order)
@@ -0,0 +1,5 @@
package com.infendro.bytes.int
operator fun Int.not(): Int {
return inv()
}