diff options
| author | Florent <florent.monjalet@gmail.com> | 2015-10-29 15:47:55 +0100 |
|---|---|---|
| committer | Florent <florent.monjalet@gmail.com> | 2015-10-29 15:47:55 +0100 |
| commit | fefb609f7ed8267815e3ab4b7467a8fada7040b8 (patch) | |
| tree | 03b82bcf93d36fa36f7cdee28b36eba3c7d59d40 /miasm2/expression/expression_helper.py | |
| parent | 967be0c4e0f8d32f6bf3e8aa9f85d0abc9ab95da (diff) | |
| parent | c4e4273c2d4e459eddc96c8ef0af0e5eff9c3f7e (diff) | |
| download | miasm-fefb609f7ed8267815e3ab4b7467a8fada7040b8.tar.gz miasm-fefb609f7ed8267815e3ab4b7467a8fada7040b8.zip | |
Merge pull request #250 from serpilliere/ExprInt_api
Expression: normalize ExprInt api
Diffstat (limited to 'miasm2/expression/expression_helper.py')
| -rw-r--r-- | miasm2/expression/expression_helper.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/miasm2/expression/expression_helper.py b/miasm2/expression/expression_helper.py index 196ad5cd..ece720e0 100644 --- a/miasm2/expression/expression_helper.py +++ b/miasm2/expression/expression_helper.py @@ -43,9 +43,8 @@ def merge_sliceto_slice(args): # sources_int[a.start] = a # copy ExprInt because we will inplace modify arg just below # /!\ TODO XXX never ever modify inplace args... - sources_int[a[1]] = (m2_expr.ExprInt_fromsize(a[2] - a[1], - a[0].arg.__class__( - a[0].arg)), + sources_int[a[1]] = (m2_expr.ExprInt(int(a[0].arg), + a[2] - a[1]), a[1], a[2]) elif isinstance(a[0], m2_expr.ExprSlice): @@ -86,7 +85,7 @@ def merge_sliceto_slice(args): out[0] = m2_expr.ExprInt(a) sorted_s.pop() out[1] = s_start - out[0] = m2_expr.ExprInt_fromsize(size, out[0].arg) + out[0] = m2_expr.ExprInt(int(out[0].arg), size) final_sources.append((start, out)) final_sources_int = final_sources @@ -409,7 +408,7 @@ class ExprRandom(object): @size: (optional) number max bits """ num = random.randint(0, cls.number_max % (2**size)) - return m2_expr.ExprInt_fromsize(size, num) + return m2_expr.ExprInt(num, size) @classmethod def atomic(cls, size=32): |