diff options
-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)); } /** |