about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/expression/simplifications_cond.py8
-rw-r--r--test/expression/simplifications.py6
2 files changed, 10 insertions, 4 deletions
diff --git a/miasm2/expression/simplifications_cond.py b/miasm2/expression/simplifications_cond.py
index c6e455b6..a5acdba6 100644
--- a/miasm2/expression/simplifications_cond.py
+++ b/miasm2/expression/simplifications_cond.py
@@ -197,13 +197,13 @@ def __comp_signed(arg1, arg2):
     """Return ExprInt1(1) if arg1 <s arg2 else ExprInt1(0)
     @arg1, @arg2: ExprInt"""
 
-    val1 = arg1.arg
+    val1 = int(arg1.arg)
     if val1 >> (arg1.size - 1) == 1:
-        val1 = - (arg1.mask.arg ^ val1 + 1)
+        val1 = - ((int(arg1.mask.arg) ^ val1) + 1)
 
-    val2 = arg2.arg
+    val2 = int(arg2.arg)
     if val2 >> (arg2.size - 1) == 1:
-        val2 = - (arg2.mask.arg ^ val2 + 1)
+        val2 = - ((int(arg2.mask.arg) ^ val2) + 1)
 
     return m2_expr.ExprInt1(1) if (val1 < val2) else m2_expr.ExprInt1(0)
 
diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py
index acef0904..a4592e9d 100644
--- a/test/expression/simplifications.py
+++ b/test/expression/simplifications.py
@@ -349,6 +349,12 @@ to_test = [
     (ExprOp_equal(ExprInt32(12), ExprInt32(-12)), ExprInt1(0)),
     (ExprCond(a - b, ExprInt1(0), ExprInt1(1)), ExprOp_equal(a, b)),
     (ExprCond(a + b, ExprInt1(0), ExprInt1(1)), ExprOp_equal(a, -b)),
+    (ExprOp_inf_signed(ExprInt32(-2), ExprInt32(3)), ExprInt1(1)),
+    (ExprOp_inf_signed(ExprInt32(3), ExprInt32(-3)), ExprInt1(0)),
+    (ExprOp_inf_signed(ExprInt32(2), ExprInt32(3)), ExprInt1(1)),
+    (ExprOp_inf_signed(ExprInt32(-3), ExprInt32(-2)), ExprInt1(1)),
+    (ExprOp_inf_signed(ExprInt32(0), ExprInt32(2)), ExprInt1(1)),
+    (ExprOp_inf_signed(ExprInt32(-3), ExprInt32(0)), ExprInt1(1)),
 ]
 
 expr_simp_cond = ExpressionSimplifier()