Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
>>> def pmod(a, b):
... if a >= 0:
... return a % b
... return b-((-a)%b)
...
>>> def tos(a,b):
... if a < b:
... return a
... return a-2*b
...
>>> for u in range(-2**24,2**24):
... assert (tos(pmod(u,4096), 2048) == tos(u&0xfff,2048))
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.