about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2020-05-22 00:23:16 +0200
committerGitHub <noreply@github.com>2020-05-22 00:23:16 +0200
commit65ab7b8ce226c37be4e22190e16a86fa9bb9c37f (patch)
treef0e001a8a9e508be3d52bd01f435849c76551be2
parent6b08a069e830951d0d5baed292948bb4cbefc811 (diff)
parent3fa97bf34640065c40c8a8640fb307c9beef2d5f (diff)
downloadmiasm-65ab7b8ce226c37be4e22190e16a86fa9bb9c37f.tar.gz
miasm-65ab7b8ce226c37be4e22190e16a86fa9bb9c37f.zip
Merge pull request #1231 from nofiv/patch-3
simp_cmp_bijective_op improvement
-rw-r--r--miasm/expression/simplifications_common.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/miasm/expression/simplifications_common.py b/miasm/expression/simplifications_common.py
index f12ccfcf..f68b8ed5 100644
--- a/miasm/expression/simplifications_common.py
+++ b/miasm/expression/simplifications_common.py
@@ -1081,6 +1081,13 @@ def simp_cmp_bijective_op(expr_simp, expr):
             args_a.remove(value)
             args_b.remove(value)
 
+    # a + b == a + b + c
+    if not args_a:
+        return ExprOp(TOK_EQUAL, ExprOp(op, *args_b), ExprInt(0, args_b[0].size))
+    # a + b + c == a + b
+    if not args_b:
+        return ExprOp(TOK_EQUAL, ExprOp(op, *args_a), ExprInt(0, args_a[0].size))
+    
     arg_a = ExprOp(op, *args_a)
     arg_b = ExprOp(op, *args_b)
     return ExprOp(TOK_EQUAL, arg_a, arg_b)