right shift math errors: 1>>32 = 1
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openjdk-6 (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
the right shift operator produces wrong results when shifting ints by 32 bits.
Description: Ubuntu 9.04
Release: 9.04
openjdk-6-jre 6b14-1.
Linux cryptovide-dev 2.6.28-18-generic #60-Ubuntu SMP Fri Mar 12 04:26:47 UTC 2010 x86_64 GNU/Linux
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.
OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)
class Tmp {
public static void main(String[] args) {
}
}
1>>1 = 0
1>>2 = 0
1>>31 = 0
1>>32 = 1 <---------- should be 0
1>>33 = 0
not actually a bug: the java spec specifies that only the last five bits of the second argument are used.