Skip to content

Instantly share code, notes, and snippets.

@maxcountryman
Created April 18, 2011 09:24
Show Gist options
  • Save maxcountryman/925066 to your computer and use it in GitHub Desktop.
Save maxcountryman/925066 to your computer and use it in GitHub Desktop.
recursive bitwise addition
add = lambda x, y : add((x & y) << 1, x ^ y) if x != 0 else y; add(13,29)
def add_again(x, y):
if x == 0:
return y
else:
return add_again((x & y) << 1, x ^ y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment