Created
April 18, 2011 09:24
-
-
Save maxcountryman/925066 to your computer and use it in GitHub Desktop.
recursive bitwise addition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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