Rewrite copyInto without using copyRangeTo
Rename array copying implementation to arrayCopy
This commit is contained in:
@@ -611,7 +611,7 @@ object ArrayOps : TemplateGroupBase() {
|
|||||||
val thisSize = size
|
val thisSize = size
|
||||||
val arraySize = elements.size
|
val arraySize = elements.size
|
||||||
val result = copyOfUninitializedElements(thisSize + arraySize)
|
val result = copyOfUninitializedElements(thisSize + arraySize)
|
||||||
elements.copyRangeTo(result, 0, arraySize, thisSize)
|
elements.copyInto(result, thisSize)
|
||||||
return result
|
return result
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@@ -687,10 +687,19 @@ object ArrayOps : TemplateGroupBase() {
|
|||||||
suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
this.copyRangeTo(destination, startIndex, endIndex, destinationOffset)
|
arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
|
||||||
return destination
|
return destination
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
specialFor(InvariantArraysOfObjects) {
|
||||||
|
body {
|
||||||
|
"""
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
arrayCopy(this as Array<Any?>, startIndex, destination as Array<Any?>, destinationOffset, endIndex - startIndex)
|
||||||
|
return destination
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user