Skip to content

Instantly share code, notes, and snippets.

@malloc47 malloc47/bit.clj
Last active May 24, 2016

Embed
What would you like to do?
(ns bit)
(defn printb
[n]
(Integer/toBinaryString n))
(defn count-1s
[n]
(->> n printb (filter #{\1}) count))
# bit-and bit-or bit-xor bit-not bit-flip bit-set bit-shift-right bit-shift-left bit-and-not bit-clear bit-test unsigned-bit-shift-right
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.