Closed Yaffle closed 9 years ago
OK, seems, everything can be simpler What about new code?
The code looks great, and is clearly much faster than the existing implementation.
However, according to the jsperf, the overall fastest is "usingBitwiseOperations", not "usingLogarithm". Any reason not to use the bitwise method?
@ljharb , bitwise method is bigger and uses 1) bitwise operations; 2) hardcoded precomputed constants
OK, let's merge this now, and consider the bitwise approach in the future.
see http://jsperf.com/read-leading-zeros/23