Files
kotlin/compiler/testData/codegen/bytecodeText/inlineClasses/uIntArraySwapBoxing.kt
Mikhail Zarechenskiy 01d9be65bc Perform bytecode optimisations for inline classes
#KT-23742 Fixed
2018-06-18 11:52:36 +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] }
}
// 0 INVOKEVIRTUAL UInt.unbox
// 0 INVOKESTATIC UInt\$Erased.box
// 0 intValue
// 0 valueOf