diff options
| author | Ajax <commial@gmail.com> | 2018-07-10 14:07:57 +0200 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2018-07-10 14:14:35 +0200 |
| commit | a5fd75194b2af753e16762c8ea08017e8ae6d5c8 (patch) | |
| tree | f1498b7bd2b571796745168665aa0b10e32453c0 /miasm2/expression/expression.py | |
| parent | b9156bcda28ca8b267f3c7319c4cf917dcab777d (diff) | |
| download | miasm-a5fd75194b2af753e16762c8ea08017e8ae6d5c8.tar.gz miasm-a5fd75194b2af753e16762c8ea08017e8ae6d5c8.zip | |
Introduce the new float notation and operations for x86 semantic
Basically, operations are: - fpconvert_fp32, fpconvert_fp64, fpconvert_fp80: convert from a floating point to another (truncate or extend) - sint_to_fp32, sint_to_fp64, sint_to_fp80: convert from a signed integer to a floating point number (original size can differ) - fp_to_sint32, fp_to_sint64, ...: convert from a floating point number to a signed integer, as ExprInt. Rounding mode is nearbyint. (original size can differ) - fpround_nearbyint: convert from floating point to floating point using the nearest int - fpround_towardszero: convert from floating point to floating point, towards zero
Diffstat (limited to 'miasm2/expression/expression.py')
| -rw-r--r-- | miasm2/expression/expression.py | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/miasm2/expression/expression.py b/miasm2/expression/expression.py index 8e63e6a2..7d5d9d45 100644 --- a/miasm2/expression/expression.py +++ b/miasm2/expression/expression.py @@ -1018,26 +1018,12 @@ class ExprOp(Expr): TOK_POS_STRICT, ]: size = 1 - elif self._op in ['mem_16_to_double', 'mem_32_to_double', - 'mem_64_to_double', 'mem_80_to_double', - 'int_16_to_double', 'int_32_to_double', - 'int_64_to_double', 'int_80_to_double']: - size = 64 - elif self._op in ['double_to_mem_16', 'double_to_int_16', - 'float_trunc_to_int_16', 'double_trunc_to_int_16']: - size = 16 - elif self._op in ['double_to_mem_32', 'double_to_int_32', - 'float_trunc_to_int_32', 'double_trunc_to_int_32', - 'double_to_float']: - size = 32 - elif self._op in ['double_to_mem_64', 'double_to_int_64', - 'float_trunc_to_int_64', 'double_trunc_to_int_64', - 'float_to_double']: - size = 64 - elif self._op in ['double_to_mem_80', 'double_to_int_80', - 'float_trunc_to_int_80', - 'double_trunc_to_int_80']: - size = 80 + elif self._op.startswith("sint_to_fp"): + size = int(self._op[len("sint_to_fp"):]) + elif self._op.startswith("fp_to_sint"): + size = int(self._op[len("fp_to_sint"):]) + elif self._op.startswith("fpconvert_fp"): + size = int(self._op[len("fpconvert_fp"):]) elif self._op in ['segm']: size = self._args[1].size else: |