This commit is contained in:
@@ -45,8 +45,27 @@ fun UIntArray.copyInto(
|
||||
require(startIndex in 0..(size - length))
|
||||
require(destinationOffset in 0..(destination.size - (length * 4)))
|
||||
|
||||
repeat(length) { i ->
|
||||
this[startIndex + i].copyInto(destination, destinationOffset + (i * 4), order)
|
||||
when (order) {
|
||||
BIG_ENDIAN -> {
|
||||
repeat(length) { i ->
|
||||
val offset = destinationOffset + (i * 4)
|
||||
val value = this[startIndex + i]
|
||||
destination[offset] = (value shr 24).toUByte()
|
||||
destination[offset + 1] = (value shr 16).toUByte()
|
||||
destination[offset + 2] = (value shr 8).toUByte()
|
||||
destination[offset + 3] = value.toUByte()
|
||||
}
|
||||
}
|
||||
LITTLE_ENDIAN -> {
|
||||
repeat(length) { i ->
|
||||
val offset = destinationOffset + (i * 4)
|
||||
val value = this[startIndex + i]
|
||||
destination[offset] = value.toUByte()
|
||||
destination[offset + 1] = (value shr 8).toUByte()
|
||||
destination[offset + 2] = (value shr 16).toUByte()
|
||||
destination[offset + 3] = (value shr 24).toUByte()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user