I just discovered that the Byte and Short classes ...
# getting-started
c
I just discovered that the Byte and Short classes (and their unsigned counterparts) have no 
shl
 or 
shr
 infix functions. Is this intentional or not?
e
the operations don't exist in bytecode, only int and long shifts exist. Java automatically promotes byte/short values to int before all operations, and Kotlin does that for arithmetic like plus minus etc., but not shift. probably just not high priority, you can simply call
.toInt()
first
c
As a bonus, the reason it doesn't exist in Java, is because it doesn't exist in CPU architectures.
To my knowledge,
.toInt
and company are implemented as compiler intrinsics with a bit of magic, so they are more or less here so you know what you're doing, but have no performance impact at all
e
that's not 100% true on x86 due to compatibility going back to the 16-bit 8086/8088, but in practice none of those are faster