fix issue in SelectableInt.__rsub__ causing truncation of values
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 11 Jul 2022 12:21:44 +0000 (13:21 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 11 Jul 2022 12:29:55 +0000 (13:29 +0100)
src/openpower/decoder/selectable_int.py

index a3eca3d426a3857eaceb54079179412f059fcfa8..675243a2ba727b66b03db753f251f8749cb673c7 100644 (file)
@@ -253,11 +253,12 @@ class SelectableInt:
         return self
 
     def __rsub__(self, b):
+        log("rsub", b, self.value)
         if isinstance(b, int):
-            b = SelectableInt(b, self.bits)
-        b = check_extsign(self, b)
-        assert b.bits == self.bits
-        return SelectableInt(b.value - self.value, self.bits)
+            b = SelectableInt(b, 256) # max extent
+        #b = check_extsign(self, b)
+        #assert b.bits == self.bits
+        return SelectableInt(b.value - self.value, b.bits)
 
     def __radd__(self, b):
         if isinstance(b, int):