File: BadShiftAmount.md

package info (click to toggle)
error-prone-java 2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 23,204 kB
  • sloc: java: 222,992; xml: 1,319; sh: 25; makefile: 7
file content (7 lines) | stat: -rw-r--r-- 377 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
For shift operations on int types, only the five lowest-order bits of the shift
amount are used as the shift distance. This means that shift amounts that are
not in the range 0 to 31, inclusive, are silently mapped to values in that
range. For example, a shift of an int by 32 is equivalent to shifting by 0,
i.e., a no-op.

See JLS 15.19, "Shift Operators", for more details.