Rewrite copyInto without using copyRangeTo

Rename array copying implementation to arrayCopy
This commit is contained in:
Ilya Gorbunov
2018-12-28 02:57:12 +03:00
parent b8d9e896c2
commit c1a51d44a4
@@ -611,7 +611,7 @@ object ArrayOps : TemplateGroupBase() {
val thisSize = size
val arraySize = elements.size
val result = copyOfUninitializedElements(thisSize + arraySize)
elements.copyRangeTo(result, 0, arraySize, thisSize)
elements.copyInto(result, thisSize)
return result
"""
}
@@ -687,10 +687,19 @@ object ArrayOps : TemplateGroupBase() {
suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
body {
"""
this.copyRangeTo(destination, startIndex, endIndex, destinationOffset)
arrayCopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
return destination
"""
}
specialFor(InvariantArraysOfObjects) {
body {
"""
@Suppress("UNCHECKED_CAST")
arrayCopy(this as Array<Any?>, startIndex, destination as Array<Any?>, destinationOffset, endIndex - startIndex)
return destination
"""
}
}
}
}
}