Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Comments¶
When you use
1L shl 2,shlis considered as the left-shift operator instead of a method call.Bitwise operators are computed from left to the right.
Bitwise operators have relatively low priority (lower than arithmatic operators), It is suggested that you use parentheses when you mix lower precendenc (bitwise opertors, ternary opertor, etc.) and high precendenc operators together. A even better approach in Kotlin is to avoid using bitwise operators and use the corresponding methods instead.
1L shl 241L shl 2 xor 4 01L shl 2 xor 4 xor 88Precedence of Bitwise operators¶
Bitwise operators are computed from the left to the right.
1L shl 241L shl 2 xor 4 01L shl 2 xor 4 xor 88