[WASM] Add array copy intrinsic
This commit is contained in:
@@ -919,26 +919,6 @@ object ArrayOps : TemplateGroupBase() {
|
||||
"""
|
||||
}
|
||||
}
|
||||
on(Backend.Wasm) {
|
||||
body {
|
||||
"""
|
||||
AbstractList.checkRangeIndexes(startIndex, endIndex, this.size)
|
||||
val rangeSize = endIndex - startIndex
|
||||
AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)
|
||||
|
||||
if (this !== destination || destinationOffset <= startIndex) {
|
||||
for (index in 0 until rangeSize) {
|
||||
destination[destinationOffset + index] = this[startIndex + index]
|
||||
}
|
||||
} else {
|
||||
for (index in rangeSize - 1 downTo 0) {
|
||||
destination[destinationOffset + index] = this[startIndex + index]
|
||||
}
|
||||
}
|
||||
return destination
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user