From 2ae825133430a71e3b16a2699edf08ae63a03d7f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 28 May 2016 14:52:48 -0700 Subject: add getBits and not-equals helper funcs for Literal --- src/wasm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/wasm.h') diff --git a/src/wasm.h b/src/wasm.h index e8f82f47c..f59e4368f 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -250,6 +250,14 @@ private: } } + int64_t getBits() { + switch (type) { + case WasmType::i32: case WasmType::f32: return i32; + case WasmType::i64: case WasmType::f64: return i64; + default: abort(); + } + } + bool operator==(const Literal& other) const { if (type != other.type) return false; switch (type) { @@ -262,6 +270,10 @@ private: } } + bool operator!=(const Literal& other) const { + return !(*this == other); + } + static uint32_t NaNPayload(float f) { assert(std::isnan(f) && "expected a NaN"); // SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF -- cgit v1.2.3