diff options
author | Christian Thalinger <twisti@complang.tuwien.ac.at> | 2008-07-01 08:12:29 +0000 |
---|---|---|
committer | Christian Thalinger <twisti@complang.tuwien.ac.at> | 2008-07-01 08:12:29 +0000 |
commit | 85fa6ef727bedcd63a35e8f2c55a677e2ed127dd (patch) | |
tree | 102730e5a0764824adf85e61f6c0e5fc51e8e466 | |
parent | 55abe0ee610584d60c0f349d16ee5d045c6952b9 (diff) | |
download | classpath-85fa6ef727bedcd63a35e8f2c55a677e2ed127dd.tar.gz |
2008-07-01 Christian Thalinger <twisti@complang.tuwien.ac.at>
* java/lang/Long.java (signum): Implemented properly as described
in Hacker's Delight Section 2-7.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | java/lang/Long.java | 3 |
2 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2008-07-01 Christian Thalinger <twisti@complang.tuwien.ac.at> + + * java/lang/Long.java (signum): Implemented properly as described + in Hacker's Delight Section 2-7. + 2008-06-30 Andrew John Hughes <gnu_andrew@member.fsf.org> PR classpath/35237: diff --git a/java/lang/Long.java b/java/lang/Long.java index d92676bb3..685271304 100644 --- a/java/lang/Long.java +++ b/java/lang/Long.java @@ -689,7 +689,8 @@ public final class Long extends Number implements Comparable<Long> */ public static int signum(long x) { - return (int)(x >> 63) - (int)(-x >> 63); + // Hacker's Delight, Section 2-7 + return (int) ((x >> 63) | (-x >>> 63)); } /** |