-
Notifications
You must be signed in to change notification settings - Fork 1
scan
Subhajit Sahu edited this page Jul 25, 2022
·
15 revisions
Find index of first set bit from LSB.
Alternatives: scan, scanReverse.
scan(x)
// x: an int32
const xbit = require('extra-bit');
xbit.scan(7);
// → 0 (111 ⇒ 0)
xbit.scan(12);
// → 2 (1100 ⇒ 2)
xbit.scan(64);
// → 6 (1000000 ⇒ 6)