Ejemplo n.º 1
0
 def signed_wrapper(self, state, b_unsigned, a_unsigned):
     b = as_signed(b_unsigned)
     a = as_signed(a_unsigned)
     value = from_signed(fn(self, state, b, a))
     # handle overflow for signed values
     overflow, result = divmod(value, self.cells)
     # NOTE: this clears overflow for all signed operations.
     # this may be wrong; I don't care right now.
     return value, overflow
Ejemplo n.º 2
0
 def signed_conditional_wrapper(self, state, b, a):
     return fn(self, state, as_signed(b), as_signed(a))
Ejemplo n.º 3
0
 def test_as_signed(self):
     for v, u in self.values:
         self.assertEqual(v, as_signed(u))