Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Count leading zeros in binary representation
- * @param {number} m
- * @return {number} 0-32
- */
- export default function clz(m) {
- let c = 1 << 31, i;
- for (let i = 0; i < 32; i += 1) {
- if (c & m) return i;
- c >>>= 1;
- }
- return 32;
- }
Add Comment
Please, Sign In to add comment