Skip to content
Subhajit Sahu edited this page Jan 24, 2021 · 6 revisions

Get index of first set bit from LSB. 📰 📘

Alternatives: scan, scanReverse.


scan x
-- x: an Int
import Bit exposing (..)

scan 7
-- 0 (111 ⇒ 0)

scan 12
-- 2 (1100 ⇒ 2)

scan 64
-- 6 (1000000 ⇒ 6)


References

Clone this wiki locally