daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Aug 17th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Count leading zeros in binary representation
  3.  * @param {number} m
  4.  * @return {number} 0-32
  5.  */
  6. export default function clz(m) {
  7.   let c = 1 << 31, i;
  8.   for (let i = 0; i < 32; i += 1) {
  9.     if (c & m) return i;
  10.     c >>>= 1;
  11.   }
  12.   return 32;
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top