From dce92af7445fd9c3cb82636efbed6e197ec5c5e1 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 15 Feb 2017 15:21:12 +0300 Subject: [PATCH] STDLIB: boolean array routines: copyRangeTo --- runtime/src/main/cpp/Arrays.cpp | 4 ++++ runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/runtime/src/main/cpp/Arrays.cpp b/runtime/src/main/cpp/Arrays.cpp index 647acd41f98..47a2c4fed7b 100644 --- a/runtime/src/main/cpp/Arrays.cpp +++ b/runtime/src/main/cpp/Arrays.cpp @@ -276,6 +276,10 @@ void Kotlin_DoubleArray_copyImpl(KConstRef thiz, KInt fromIndex, copyImpl(thiz, fromIndex, destination, toIndex, count); } +void Kotlin_BooleanArray_copyImpl(KConstRef thiz, KInt fromIndex, + KRef destination, KInt toIndex, KInt count) { + copyImpl(thiz, fromIndex, destination, toIndex, count); +} KLong Kotlin_LongArray_get(KConstRef thiz, KInt index) { const ArrayHeader* array = thiz->array(); diff --git a/runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt b/runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt index 16b58e9944b..dff4cd24fc0 100644 --- a/runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt +++ b/runtime/src/main/kotlin/kotlin/collections/ArrayUtil.kt @@ -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].