openjdk team mailing list archive
-
openjdk team
-
Mailing list archive
-
Message #03989
[Bug 601266] Re: right shift math errors: 1>>32 = 1
not actually a bug: the java spec specifies that only the last five bits
of the second argument are used.
** Changed in: openjdk-6 (Ubuntu)
Status: New => Invalid
--
right shift math errors: 1>>32 = 1
https://bugs.launchpad.net/bugs/601266
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-6 in ubuntu.
Status in “openjdk-6” package in Ubuntu: Invalid
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.4.1-0ubuntu13
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.4.1-0ubuntu13)
OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)
class Tmp {
public static void main(String[] args) {
System.out.println("1>>1 = "+(1>>1));
System.out.println("1>>2 = "+(1>>2));
System.out.println("1>>31 = "+(1>>31));
System.out.println("1>>32 = "+(1>>32));
System.out.println("1>>33 = "+(1>>33));
}
}
1>>1 = 0
1>>2 = 0
1>>31 = 0
1>>32 = 1 <---------- should be 0
1>>33 = 0
References