summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-04 20:25:16 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-04 20:25:16 -0800
commit1b693d221566b017b63e002526bfbe724522e679 (patch)
tree8ce0b2eb0d1a3572e3a580d5a85b54a323fbf812 /src/wasm.h
parent0a4c572572944f19f839ec3052ca79c4b2d950ea (diff)
downloadbinaryen-1b693d221566b017b63e002526bfbe724522e679.tar.gz
binaryen-1b693d221566b017b63e002526bfbe724522e679.tar.bz2
binaryen-1b693d221566b017b63e002526bfbe724522e679.zip
literal ==
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 5cad00c3a..f7f6ce6b5 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -114,6 +114,13 @@ struct Literal {
float reinterpretf32() { assert(type == WasmType::i32); return f32; }
double reinterpretf64() { assert(type == WasmType::i64); return f64; }
+ bool operator==(Literal& other) {
+ if (type != other.type) return false;
+ if (type == none) return true;
+ if (type == i32 || type == f32) return i32 == other.i32;
+ return i64 == other.i64;
+ }
+
void printDouble(std::ostream &o, double d) {
const char *text = cashew::JSPrinter::numToString(d);
// spec interpreter hates floats starting with '.'