File: BadShiftAmount.md

package info (click to toggle)
error-prone-java 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 15,076 kB
  • sloc: java: 171,398; xml: 1,459; sh: 34; 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.