diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-04 20:16:54 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-04 20:16:54 -0800 |
commit | 0a4c572572944f19f839ec3052ca79c4b2d950ea (patch) | |
tree | 9a743669a8ff637b4b34f8412c3bf5ca82b88ffb /src/wasm-interpreter.h | |
parent | 6802e5795929d3725a96a3e2095b1ce836fb5335 (diff) | |
download | binaryen-0a4c572572944f19f839ec3052ca79c4b2d950ea.tar.gz binaryen-0a4c572572944f19f839ec3052ca79c4b2d950ea.tar.bz2 binaryen-0a4c572572944f19f839ec3052ca79c4b2d950ea.zip |
implement conversions
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 4862d6d9e..9bc3c7a45 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -353,9 +353,21 @@ public: if (flow.breaking()) return flow; Literal value = flow.value; switch (curr->op) { // :-) - case ConvertUInt32: return Flow(Literal(double(uint32_t(value.geti32())))); - case ConvertSInt32: return Flow(Literal(double(value.geti32()))); - case TruncSFloat64: return Flow(Literal(int32_t(value.getf64()))); + case ExtendSInt32: return Flow(Literal(int64_t(value.geti32()))); + case ExtendUInt32: return Flow(Literal(int64_t((uint32_t)value.geti32()))); + case WrapInt64: return Flow(Literal(int32_t(value.geti64()))); + case TruncSFloat32: return Flow(Literal(int32_t(value.getf32()))); + case TruncUFloat32: return Flow(Literal(uint32_t(value.getf32()))); + case TruncSFloat64: return Flow(Literal(int32_t(value.getf64()))); + case TruncUFloat64: return Flow(Literal(int32_t((uint32_t)value.getf64()))); + case ReinterpretFloat: return curr->type == i32 ? Flow(Literal(value.reinterpreti32())) : Flow(Literal(value.reinterpreti64())); + case ConvertUInt32: return Flow(Literal(double(uint32_t(value.geti32())))); + case ConvertSInt32: return Flow(Literal(double(int32_t(value.geti32())))); + case ConvertUInt64: return Flow(Literal(double((uint64_t)value.geti64()))); + case ConvertSInt64: return Flow(Literal(double(value.geti64()))); + case PromoteFloat32: return Flow(Literal(double(value.getf32()))); + case DemoteFloat64: return Flow(Literal(float(value.getf64()))); + case ReinterpretInt: return curr->type == f32 ? Flow(Literal(value.reinterpretf32())) : Flow(Literal(value.reinterpretf64())); default: abort(); } } |