From 6702a6149c57c54bcece3fb1cd00b8c09af6e74a Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Tue, 13 Feb 2018 14:24:05 +0100 Subject: X86: remove c_rez/rcl_rez/rcr_rez special operator --- miasm2/expression/simplifications_common.py | 40 +++-------------------------- 1 file changed, 4 insertions(+), 36 deletions(-) (limited to 'miasm2/expression/simplifications_common.py') diff --git a/miasm2/expression/simplifications_common.py b/miasm2/expression/simplifications_common.py index f045830e..ba938db5 100644 --- a/miasm2/expression/simplifications_common.py +++ b/miasm2/expression/simplifications_common.py @@ -48,11 +48,11 @@ def simp_cst_propagation(e_s, expr): tmp2 = mod_size2uint[int2.arg.size](int2.arg) out = mod_size2uint[int1.arg.size](tmp1 >> tmp2) elif op_name == '>>>': - out = (int1.arg >> (int2.arg % int2.size) | - int1.arg << ((int1.size - int2.arg) % int2.size)) + shifter = int2.arg % int2.size + out = (int1.arg >> shifter) | (int1.arg << (int2.size - shifter)) elif op_name == '<<<': - out = (int1.arg << (int2.arg % int2.size) | - int1.arg >> ((int1.size - int2.arg) % int2.size)) + shifter = int2.arg % int2.size + out = (int1.arg << shifter) | (int1.arg >> (int2.size - shifter)) elif op_name == '/': out = int1.arg / int2.arg elif op_name == '%': @@ -320,38 +320,6 @@ def simp_cst_propagation(e_s, expr): args.append(ExprOp(op_name, *arg)) return ExprCompose(*args) - # <<>>c_rez - if op_name in [">>>c_rez", "<<>>c_rez": - while tmp_count != 0: - tmp_cf = tmp & 1; - tmp = (tmp >> 1) + (carry_flag << (size - 1)) - carry_flag = tmp_cf - tmp_count -= 1 - tmp &= int(dest.mask) - elif op_name == "<<> (size - 1)) & 1 - tmp = (tmp << 1) + carry_flag - carry_flag = tmp_cf - tmp_count -= 1 - tmp &= int(dest.mask) - else: - raise RuntimeError("Unknown operation: %s" % op_name) - return ExprInt(tmp, size=dest.size) - return ExprOp(op_name, *args) -- cgit 1.4.1