libopid: fix nonzero operand
authorDmitry Selyutin <ghostmansd@gmail.com>
Sat, 9 Sep 2023 18:16:17 +0000 (21:16 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sat, 9 Sep 2023 18:16:17 +0000 (21:16 +0300)
src/libopid/codegen.py

index 1d0f11d7d00f937b638c6468e89f48b5c6449289..349b2e572bb114a781462e4e6fe60e5162c1159c 100644 (file)
@@ -279,7 +279,12 @@ class DisGenSource(Source):
             self.emit("break;")
 
         def nonzero_handler(span):
-            yield from generic_handler(span, "OPID_OPERAND_NONZERO")
+            yield f"value = (UINT32_C(1) + ("
+            with self:
+                yield from fetch(span)
+            yield f"));"
+            yield f"flags = OPID_OPERAND_NONZERO;"
+            self.emit("break;")
 
         def signed_handler(span, flags="OPID_OPERAND_SIGNED"):
             mask = f"(UINT32_C(1) << (UINT32_C({len(span)}) - 1))"