[WASM] Add array copy intrinsic

This commit is contained in:
Igor Yakovlev
2022-06-29 18:51:31 +02:00
committed by teamcity
parent 8306b1bd71
commit 0ea7e8b70a
17 changed files with 218 additions and 203 deletions
@@ -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
"""
}
}
}
}
}