Skip to content

Instantly share code, notes, and snippets.


Zach Wegner zwegner

View GitHub Profile
zwegner / gist:0202c60b9410d029b5cfc5c5643e3374
Last active Jan 13, 2020 — forked from dougallj/gist:9211fd24c3759f7f340dede28929c659
Ternary logic multiplication (0, 1, unknown)
View gist:0202c60b9410d029b5cfc5c5643e3374
import itertools
N_BITS = 8
MASK = (1 << N_BITS) - 1
# Bit class, which stores values as a truth table of up to two variables
class Bit:
def __init__(self, op, bit_a=None, bit_b=None):
self.op = op
# Remove variables when the truth table doesn't depend on them
You can’t perform that action at this time.