Skip to content

Instantly share code, notes, and snippets.

@akarve
Last active February 6, 2021 03:58
Show Gist options
  • Save akarve/e63185d7327489e96dc847cd7334e668 to your computer and use it in GitHub Desktop.
Save akarve/e63185d7327489e96dc847cd7334e668 to your computer and use it in GitHub Desktop.
def binop(fun: int, x: int, y: int) -> int:
val = (x << 1) + y
return (fun >> val) & 1
possible = set()
# h(x, g(y, z))
for h in range(16):
for g in range(16):
outputs = 0
for n in range(8):
x = n >> 2 & 1
y = n >> 1 & 1
z = n >> 0 & 1
out = binop(h, x, binop(g, y, z))
outputs = outputs | (out << n)
possible.add(outputs)
print(possible)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment