Skip to content

Instantly share code, notes, and snippets.

@aamedina
Created May 1, 2014 14:09
Show Gist options
  • Select an option

  • Save aamedina/cc392e6206dfef3094ce to your computer and use it in GitHub Desktop.

Select an option

Save aamedina/cc392e6206dfef3094ce to your computer and use it in GitHub Desktop.
(defmethod native-size clojure.lang.BigInt
"Determine the number of bits necessary to represent an integer of arbitrary precision."
[n]
(count (take-while pos? (iterate #(quot % 2) n))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment