diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/lang/Long.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/java/lang/Long.java b/java/lang/Long.java index 685271304..a5ee6c707 100644 --- a/java/lang/Long.java +++ b/java/lang/Long.java @@ -689,8 +689,14 @@ public final class Long extends Number implements Comparable<Long> */ public static int signum(long x) { - // Hacker's Delight, Section 2-7 return (int) ((x >> 63) | (-x >>> 63)); + + // The LHS propagates the sign bit through every bit in the word; + // if X < 0, every bit is set to 1, else 0. if X > 0, the RHS + // negates x and shifts the resulting 1 in the sign bit to the + // LSB, leaving every other bit 0. + + // Hacker's Delight, Section 2-7 } /** |
