about summary refs log tree commit diff stats
path: root/miasm/expression/expression_helper.py
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2012-01-20 09:27:08 +0100
committerserpilliere <devnull@localhost>2012-01-20 09:27:08 +0100
commit9369199f0856f8ffc8b7a6599345845305f3a66b (patch)
tree821415a117270caf15064374d2d57dfcfbe55683 /miasm/expression/expression_helper.py
parent866645102ecce32a9a542a4d18f9a611d621ac5b (diff)
downloadfocaccia-miasm-9369199f0856f8ffc8b7a6599345845305f3a66b.tar.gz
focaccia-miasm-9369199f0856f8ffc8b7a6599345845305f3a66b.zip
fix pe_helper
Diffstat (limited to 'miasm/expression/expression_helper.py')
-rw-r--r--miasm/expression/expression_helper.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/miasm/expression/expression_helper.py b/miasm/expression/expression_helper.py
index c6bcfa8e..99f8331e 100644
--- a/miasm/expression/expression_helper.py
+++ b/miasm/expression/expression_helper.py
@@ -231,6 +231,12 @@ def expr_simp_w(e):
             args0 = args[0].args[0]
             args = [args0, ExprInt(args1)]
 
+        if op in ['+'] and isinstance(args[1], ExprInt) and isinstance(args[0], ExprOp) and args[0].op in ['+', '-'] and isinstance(args[0].args[0], ExprInt):
+            op = args[0].op
+            args1 = args[0].args[0].arg + args[1].arg
+            args0 = args[0].args[1]
+            args = [ExprInt(args1), args0]
+
         #0 - (a-b) => b-a
         if op == '-' and isinstance(args[0], ExprInt) and args[0].arg == 0 and isinstance(args[1], ExprOp) and args[1].op == "-":
             return expr_simp(args[1].args[1] - args[1].args[0])