diff options
Diffstat (limited to 'miasm2/expression')
| -rw-r--r-- | miasm2/expression/expression.py | 3 | ||||
| -rw-r--r-- | miasm2/expression/expression_helper.py | 2 | ||||
| -rw-r--r-- | miasm2/expression/simplifications_common.py | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/miasm2/expression/expression.py b/miasm2/expression/expression.py index de6746ef..c9c2627c 100644 --- a/miasm2/expression/expression.py +++ b/miasm2/expression/expression.py @@ -217,6 +217,9 @@ class Expr(object): def __neg__(self): return ExprOp('-', self) + def __pow__(self, a): + return ExprOp("**",self, a) + def __invert__(self): s = self.size return ExprOp('^', self, ExprInt(mod_size2uint[s](size2mask(s)))) diff --git a/miasm2/expression/expression_helper.py b/miasm2/expression/expression_helper.py index 44b4b5af..09feffc2 100644 --- a/miasm2/expression/expression_helper.py +++ b/miasm2/expression/expression_helper.py @@ -135,7 +135,7 @@ def merge_sliceto_slice(args): op_propag_cst = ['+', '*', '^', '&', '|', '>>', '<<', "a>>", ">>>", "<<<", - "/", "%", 'idiv', 'imod', 'umod', 'udiv'] + "/", "%", 'idiv', 'imod', 'umod', 'udiv','**'] def is_pure_int(e): diff --git a/miasm2/expression/simplifications_common.py b/miasm2/expression/simplifications_common.py index a52debe6..2d5e4e6b 100644 --- a/miasm2/expression/simplifications_common.py +++ b/miasm2/expression/simplifications_common.py @@ -30,6 +30,8 @@ def simp_cst_propagation(e_s, e): o = i1.arg + i2.arg elif op == '*': o = i1.arg * i2.arg + elif op == '**': + o =i1.arg ** i2.arg elif op == '^': o = i1.arg ^ i2.arg elif op == '&': @@ -194,7 +196,7 @@ def simp_cst_propagation(e_s, e): j += 1 i += 1 - if op in ['|', '&', '%', '/'] and len(args) == 1: + if op in ['|', '&', '%', '/', '**'] and len(args) == 1: return args[0] # A <<< A.size => A |