(defn
bit-count
"Counts the number of bits set in n"
[v]
(let
[v
(- v (bit-and (bit-shift-right v 1) 1431655765))
v
(+ (bit-and v 858993459) (bit-and (bit-shift-right v 2) 858993459))]
(bit-shift-right
(* (bit-and (+ v (bit-shift-right v 4)) 252645135) 16843009)
24)))