Skip to content

Instantly share code, notes, and snippets.

@rodericj
Created August 30, 2010 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodericj/558018 to your computer and use it in GitHub Desktop.
Save rodericj/558018 to your computer and use it in GitHub Desktop.
def increment(self, i):
if i == ~1/2:
return 0
if i % 2 == 0:
return i | 1
else:
return self.increment(i>>1)<<1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment