--- a/src/java.base/share/classes/java/lang/Long.java Tue May 22 05:20:48 2018 -0400
+++ b/src/java.base/share/classes/java/lang/Long.java Tue May 22 14:44:18 2018 +0200
@@ -1761,18 +1761,9 @@
*/
@HotSpotIntrinsicCandidate
public static int numberOfLeadingZeros(long i) {
- // HD, Figure 5-6
- if (i <= 0)
- return i == 0 ? 64 : 0;
- int n = 1;
int x = (int)(i >>> 32);
- if (x == 0) { n += 32; x = (int)i; }
- if (x >>> 16 == 0) { n += 16; x <<= 16; }
- if (x >>> 24 == 0) { n += 8; x <<= 8; }
- if (x >>> 28 == 0) { n += 4; x <<= 4; }
- if (x >>> 30 == 0) { n += 2; x <<= 2; }
- n -= x >>> 31;
- return n;
+ return x == 0 ? 32 + Integer.numberOfLeadingZeros((int)i)
+ : Integer.numberOfLeadingZeros(x);
}
/**