Guest User

Untitled

a guest
Aug 17th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment