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))
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)))
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)))
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)))
def unary_arith(stream, machine): s = machine.pop() l = len(s) x = s.signed(endian="little") machine.push(bytestream.fromsigned(f(x), l))