Make a more correct implementation of unsigned arrays copyInto
Return the destination array instead of the destination storage array wrapped in a new unsigned array. The difference should be indistinguishable, however in JS, where inline classes are not inlined yet, it had resulted in an extra wrapper.
This commit is contained in:
@@ -346,7 +346,8 @@ public fun UShortArray.contentToString(): String {
|
|||||||
@ExperimentalUnsignedTypes
|
@ExperimentalUnsignedTypes
|
||||||
@kotlin.internal.InlineOnly
|
@kotlin.internal.InlineOnly
|
||||||
public inline fun UIntArray.copyInto(destination: UIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UIntArray {
|
public inline fun UIntArray.copyInto(destination: UIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UIntArray {
|
||||||
return UIntArray(storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex))
|
storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)
|
||||||
|
return destination
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -369,7 +370,8 @@ public inline fun UIntArray.copyInto(destination: UIntArray, destinationOffset:
|
|||||||
@ExperimentalUnsignedTypes
|
@ExperimentalUnsignedTypes
|
||||||
@kotlin.internal.InlineOnly
|
@kotlin.internal.InlineOnly
|
||||||
public inline fun ULongArray.copyInto(destination: ULongArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ULongArray {
|
public inline fun ULongArray.copyInto(destination: ULongArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ULongArray {
|
||||||
return ULongArray(storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex))
|
storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)
|
||||||
|
return destination
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -392,7 +394,8 @@ public inline fun ULongArray.copyInto(destination: ULongArray, destinationOffset
|
|||||||
@ExperimentalUnsignedTypes
|
@ExperimentalUnsignedTypes
|
||||||
@kotlin.internal.InlineOnly
|
@kotlin.internal.InlineOnly
|
||||||
public inline fun UByteArray.copyInto(destination: UByteArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UByteArray {
|
public inline fun UByteArray.copyInto(destination: UByteArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UByteArray {
|
||||||
return UByteArray(storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex))
|
storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)
|
||||||
|
return destination
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -415,7 +418,8 @@ public inline fun UByteArray.copyInto(destination: UByteArray, destinationOffset
|
|||||||
@ExperimentalUnsignedTypes
|
@ExperimentalUnsignedTypes
|
||||||
@kotlin.internal.InlineOnly
|
@kotlin.internal.InlineOnly
|
||||||
public inline fun UShortArray.copyInto(destination: UShortArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UShortArray {
|
public inline fun UShortArray.copyInto(destination: UShortArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UShortArray {
|
||||||
return UShortArray(storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex))
|
storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)
|
||||||
|
return destination
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -517,7 +517,10 @@ object ArrayOps : TemplateGroupBase() {
|
|||||||
specialFor(ArraysOfUnsigned) {
|
specialFor(ArraysOfUnsigned) {
|
||||||
inlineOnly()
|
inlineOnly()
|
||||||
body {
|
body {
|
||||||
"return SELF(storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex))"
|
"""
|
||||||
|
storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)
|
||||||
|
return destination
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
specialFor(ArraysOfPrimitives, InvariantArraysOfObjects) {
|
specialFor(ArraysOfPrimitives, InvariantArraysOfObjects) {
|
||||||
|
|||||||
Reference in New Issue
Block a user