Files
kotlin/compiler/testData/codegen/bytecodeText/inlineClasses/uIntArraySwapBoxing.kt
2018-02-13 13:16:39 +03:00

23 lines
500 B
Kotlin
Vendored

// !LANGUAGE: +InlineClasses
inline class UInt(private val value: Int) {
fun asInt() = value
}
inline class UIntArray(private val intArray: IntArray) {
operator fun get(index: Int): UInt = UInt(intArray[index])
operator fun set(index: Int, value: UInt) {
intArray[index] = value.asInt()
}
}
fun UIntArray.swap(i: Int, j: Int) {
this[j] = this[i].also { this[i] = this[j] }
}
// 2 INVOKEVIRTUAL UInt.unbox
// 1 INVOKESTATIC UInt\$Erased.box
// 0 intValue
// 0 valueOf