We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Find index of first set bit from MSB.
Alternatives: scan, scanReverse.
scanReverse(x) // x: an int32
const xbit = require('extra-bit'); xbit.scanReverse(13); // → 13 (1101 ⇒ 3) xbit.scanReverse(5); // → 2 (101 ⇒ 2) xbit.scanReverse(1); // → 0 (1 ⇒ 0)