diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-05-28 14:52:48 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-05-28 14:52:48 -0700 |
commit | 2ae825133430a71e3b16a2699edf08ae63a03d7f (patch) | |
tree | 4e756286a7299a55eca3a53818b22764fa5badca /src | |
parent | 1715b4a1ec845f1dd6b08f48a599f346beb0f758 (diff) | |
download | binaryen-2ae825133430a71e3b16a2699edf08ae63a03d7f.tar.gz binaryen-2ae825133430a71e3b16a2699edf08ae63a03d7f.tar.bz2 binaryen-2ae825133430a71e3b16a2699edf08ae63a03d7f.zip |
add getBits and not-equals helper funcs for Literal
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm.h | 12 |
1 files changed, 12 insertions, 0 deletions
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 |