示例#1
0
def test_and():
    @apply_passes([bool_to_bit()])
    def and_f(x, y):
        return x and y

    assert inspect.getsource(and_f) == '''\
示例#2
0
def test_xor():
    @apply_passes([bool_to_bit()])
    def xor(x, y):
        return x and not y or not x and y

    assert inspect.getsource(xor) == '''\
示例#3
0
def test_or():
    @apply_passes([bool_to_bit()])
    def or_f(x, y):
        return x or y

    assert inspect.getsource(or_f) == '''\
示例#4
0
def test_not():
    @apply_passes([bool_to_bit()])
    def not_f(x):
        return not x

    assert inspect.getsource(not_f) == '''\
示例#5
0
文件: family.py 项目: sillycross/peak
    def __init__(self, assembler=None):
        if assembler is None:
            assembler=Assembler

        _AsmFamily.__init__(self, assembler, AssembledADT)
        _RewriterFamily.__init__(self, (ssa(), bool_to_bit(), if_to_phi(self.Bit.ite)))