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

Count bits set. 📰 📘

Similar: count, parity.


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

count 7
-- 3 (111 ⇒ 3)

count 12
-- 2 (1100 ⇒ 2)

count 63
-- 6 (111111 ⇒ 6)


References

Clone this wiki locally