Skip to content

Instantly share code, notes, and snippets.

@JoshuaChi
Last active December 31, 2015 17:19
Show Gist options
  • Save JoshuaChi/8019578 to your computer and use it in GitHub Desktop.
Save JoshuaChi/8019578 to your computer and use it in GitHub Desktop.
bits(0, R)->
R;
bits(N, R) ->
B = N band ((bnot N) + 1),
bits(N bxor B, lists:append(R, [B])).
@JoshuaChi
Copy link
Author

bits(109, []).
[1,4,8,32,64]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment