Exemplo n.º 1
0
 def unary_arith(stream, machine):
     s = machine.pop()
     l = len(s)
     x = s.signed(endian="little")
     if l > 4:
         raise InvalidTransactionException('Integer longer than 4 bytes')
     machine.push(bytestream.fromsigned(f(x), l))
Exemplo n.º 2
0
    def binary_arith(stream, machine):
        s1 = machine.pop()
        l1 = len(s1)
        x1 = s1.signed(endian="little")

        s2 = machine.pop()
        l2 = len(s2)
        x2 = s2.signed(endian="little")

        machine.push(bytestream.fromsigned(f(x1,x2), max(l1,l2)))
Exemplo n.º 3
0
    def binary_arith(stream, machine):
        s1 = machine.pop()
        l1 = len(s1)
        x1 = s1.signed(endian="little")

        s2 = machine.pop()
        l2 = len(s2)
        x2 = s2.signed(endian="little")

        if l1 > 4 or l2 > 4:  # input is longer than 4 bytes
            raise InvalidTransactionException('Integer longer than 4 bytes')

        machine.push(bytestream.fromsigned(f(x1,x2), max(l1,l2)))
Exemplo n.º 4
0
    def ternary_arith(stream, machine):
        s1 = machine.pop()
        l1 = len(s1)
        x1 = s1.signed(endian="little")

        s2 = machine.pop()
        l2 = len(s2)
        x2 = s2.signed(endian="little")

        s3 = machine.pop()
        l3 = len(s2)
        x3 = s2.signed(endian="little")

        machine.push(bytestream.fromsigned(f(x1,x2,x3), max(l1,l2,l3)))
Exemplo n.º 5
0
 def unary_arith(stream, machine):
     s = machine.pop()
     l = len(s)
     x = s.signed(endian="little")
     machine.push(bytestream.fromsigned(f(x), l))