Skip to content

Instantly share code, notes, and snippets.

@dedeco

dedeco/parity.py

Created Jan 14, 2020
Embed
What would you like to do?
Como computar o bit de paridade?
def parity(x):
result = 0
while x:
result ^= x & 1
x >>= 1
return result
if __name__ == "__main__":
print(parity(42))
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.