summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Thalinger <twisti@complang.tuwien.ac.at>2008-07-01 08:12:29 +0000
committerChristian Thalinger <twisti@complang.tuwien.ac.at>2008-07-01 08:12:29 +0000
commit85fa6ef727bedcd63a35e8f2c55a677e2ed127dd (patch)
tree102730e5a0764824adf85e61f6c0e5fc51e8e466
parent55abe0ee610584d60c0f349d16ee5d045c6952b9 (diff)
downloadclasspath-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--ChangeLog5
-rw-r--r--java/lang/Long.java3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 36d655047..2497d9cb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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));
}
/**