diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-02-02 19:07:43 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-02-02 19:20:44 -0800 |
commit | edc07c0cb8e66f8ca33de759b02cf1d3171b5df9 (patch) | |
tree | 8e9d1d53e2da585383f8b60390d35ea8a6c6c3d3 /src/wasm-interpreter.h | |
parent | 5273c5c4eb03e78c6226e928973301566c8abc2a (diff) | |
download | binaryen-edc07c0cb8e66f8ca33de759b02cf1d3171b5df9.tar.gz binaryen-edc07c0cb8e66f8ca33de759b02cf1d3171b5df9.tar.bz2 binaryen-edc07c0cb8e66f8ca33de759b02cf1d3171b5df9.zip |
simplify interpreter int reinterpreting
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 41f1996ce..b08773c16 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -378,13 +378,7 @@ private: case Clz: return Literal((int32_t)CountLeadingZeroes(v)); case Ctz: return Literal((int32_t)CountTrailingZeroes(v)); case Popcnt: return Literal((int32_t)PopCount(v)); - case ReinterpretInt: { - float v = value.reinterpretf32(); - if (isnan(v)) { - return Literal(Literal(value.geti32() | 0x7f800000).reinterpretf32()); - } - return Literal(value.reinterpretf32()); - } + case ReinterpretInt: return value.castToF32(); case ExtendSInt32: return Literal(int64_t(value.geti32())); case ExtendUInt32: return Literal(uint64_t((uint32_t)value.geti32())); case ConvertUInt32: return curr->type == f32 ? Literal(float(uint32_t(value.geti32()))) : Literal(double(uint32_t(value.geti32()))); @@ -399,9 +393,7 @@ private: case Ctz: return Literal((int64_t)CountTrailingZeroes(v)); case Popcnt: return Literal((int64_t)PopCount(v)); case WrapInt64: return Literal(int32_t(value.geti64())); - case ReinterpretInt: { - return Literal(value.reinterpretf64()); - } + case ReinterpretInt: return value.castToF64(); case ConvertUInt64: return curr->type == f32 ? Literal(float((uint64_t)value.geti64())) : Literal(double((uint64_t)value.geti64())); case ConvertSInt64: return curr->type == f32 ? Literal(float(value.geti64())) : Literal(double(value.geti64())); default: abort(); |