p
any idea?
a
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-short/plus.html adding two Short results in an Int, there's nothing special here Kotlin follows the Java idioms in primitive types and there is no JVM bytecode regarding addition of Short, JVM first convert both to Int then applies addition then returns that Int itself.
You should do
(1 + acc).toShort()