diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/lang/Long.java | 3 |
1 files changed, 2 insertions, 1 deletions
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)); } /** |