Why is there no bitwise operation support for Byte or Short?


#1

Im looking at the Primitives.kt and Im confused as to why there is no support for performing bitwise operations on Byte or Short types. Is there a technical reason for this or was it an arbitrary decision?


#2

I would guess because bitwise operators only operate on ints and longs on the Jvm. In Java bytes and shorts are implicitly promoted to int before performing the operation. So you need to explicitly convert a byte/short into an int before doing this.