summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 32f9d9130..0104e45df 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -118,6 +118,22 @@ struct Literal {
float reinterpretf32() { assert(type == WasmType::i32); return f32; }
double reinterpretf64() { assert(type == WasmType::i64); return f64; }
+ int64_t getInteger() {
+ switch (type) {
+ case WasmType::i32: return i32;
+ case WasmType::i64: return i64;
+ default: abort();
+ }
+ }
+
+ double getFloat() {
+ switch (type) {
+ case WasmType::f32: return f32;
+ case WasmType::f64: return f64;
+ default: abort();
+ }
+ }
+
bool operator==(Literal& other) {
if (type != other.type) return false;
if (type == none) return true;