How to count the leading zero bits of 32 bit integer in JavaScript

1 Answer

0 votes
console.log(Math.clz32(0b0000100000000000000000000000000));
console.log(Math.clz32(0b01000000000000000000000000000000));
console.log(Math.clz32(0b1));



/*
run:
 
5
1
31
    
*/

 



answered Mar 13, 2020 by avibootz
...