STDLIB: boolean array routines: copyRangeTo

This commit is contained in:
Vasily Levchenko
2017-02-15 15:21:12 +03:00
committed by vvlevchenko
parent c395bc80a0
commit dce92af744
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -276,6 +276,10 @@ void Kotlin_DoubleArray_copyImpl(KConstRef thiz, KInt fromIndex,
copyImpl<KDouble>(thiz, fromIndex, destination, toIndex, count);
}
void Kotlin_BooleanArray_copyImpl(KConstRef thiz, KInt fromIndex,
KRef destination, KInt toIndex, KInt count) {
copyImpl<KBoolean>(thiz, fromIndex, destination, toIndex, count);
}
KLong Kotlin_LongArray_get(KConstRef thiz, KInt index) {
const ArrayHeader* array = thiz->array();
@@ -89,6 +89,9 @@ external private fun copyImpl(array: FloatArray, fromIndex: Int,
external private fun copyImpl(array: DoubleArray, fromIndex: Int,
destination: DoubleArray, toIndex: Int, count: Int)
@SymbolName("Kotlin_BooleanArray_copyImpl")
external private fun copyImpl(array: BooleanArray, fromIndex: Int,
destination: BooleanArray, toIndex: Int, count: Int)
/**
* Copies a range of array elements at a specified [fromIndex] (inclusive) to [toIndex] (exclusive) range of indices
@@ -127,6 +130,10 @@ fun FloatArray.copyRangeTo(destination: FloatArray, fromIndex: Int, toIndex: Int
fun DoubleArray.copyRangeTo(destination: DoubleArray, fromIndex: Int, toIndex: Int, destinationIndex: Int = 0) {
copyImpl(this, fromIndex, destination, destinationIndex, toIndex - fromIndex)
}
fun BooleanArray.copyRangeTo(destination: BooleanArray, fromIndex: Int, toIndex: Int, destinationIndex: Int = 0) {
copyImpl(this, fromIndex, destination, destinationIndex, toIndex - fromIndex)
}
/**
* Copies a range of array elements at a specified [fromIndex] (inclusive) to [toIndex] (exclusive) range of indices
* to another part of this array starting at [destinationIndex].