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.h | |
parent | 6802e5795929d3725a96a3e2095b1ce836fb5335 (diff) | |
download | binaryen-0a4c572572944f19f839ec3052ca79c4b2d950ea.tar.gz binaryen-0a4c572572944f19f839ec3052ca79c4b2d950ea.tar.bz2 binaryen-0a4c572572944f19f839ec3052ca79c4b2d950ea.zip |
implement conversions
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h index 0eefdbc24..5cad00c3a 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -98,7 +98,9 @@ struct Literal { Literal() : type(WasmType::none), f64(0) {} Literal(int32_t init) : type(WasmType::i32), i32(init) {} + Literal(uint32_t init) : type(WasmType::i32), i32(init) {} Literal(int64_t init) : type(WasmType::i64), i64(init) {} + Literal(uint64_t init) : type(WasmType::i64), i64(init) {} Literal(float init) : type(WasmType::f32), f32(init) {} Literal(double init) : type(WasmType::f64), f64(init) {} @@ -107,6 +109,11 @@ struct Literal { float getf32() { assert(type == WasmType::f32); return f32; } double getf64() { assert(type == WasmType::f64); return f64; } + int32_t reinterpreti32() { assert(type == WasmType::f32); return i32; } + int64_t reinterpreti64() { assert(type == WasmType::f64); return i64; } + float reinterpretf32() { assert(type == WasmType::i32); return f32; } + double reinterpretf64() { assert(type == WasmType::i64); return f64; } + void printDouble(std::ostream &o, double d) { const char *text = cashew::JSPrinter::numToString(d); // spec interpreter hates floats starting with '.' |