diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2018-12-12 14:11:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-12 14:11:04 -0800 |
commit | 75b693434b5af75d105af4900b5d0c6048155421 (patch) | |
tree | 233cf1c142d7695c1239fe84135cbfd0d463350f /src/wasm/literal.cpp | |
parent | 7edaebedb0f7185fae0f3fbf146a1c6b44842f5c (diff) | |
download | binaryen-75b693434b5af75d105af4900b5d0c6048155421.tar.gz binaryen-75b693434b5af75d105af4900b5d0c6048155421.tar.bz2 binaryen-75b693434b5af75d105af4900b5d0c6048155421.zip |
Update wrap and demote literal op names (#1817)
* Update literal op names
* Remove `demoteToF32` in favor of `demote`
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r-- | src/wasm/literal.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index ece92c6ee..7b9e64e43 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -223,35 +223,30 @@ Literal Literal::extendS32() const { WASM_UNREACHABLE(); } -Literal Literal::truncateToI32() const { +Literal Literal::wrapToI32() const { assert(type == Type::i64); return Literal((int32_t)i64); } -Literal Literal::truncateToF32() const { - assert(type == Type::f64); - return Literal(float(getf64())); -} - -Literal Literal::truncSIToF32() const { +Literal Literal::convertSIToF32() const { if (type == Type::i32) return Literal(float(i32)); if (type == Type::i64) return Literal(float(i64)); WASM_UNREACHABLE(); } -Literal Literal::truncUIToF32() const { +Literal Literal::convertUIToF32() const { if (type == Type::i32) return Literal(float(uint32_t(i32))); if (type == Type::i64) return Literal(float(uint64_t(i64))); WASM_UNREACHABLE(); } -Literal Literal::truncSIToF64() const { +Literal Literal::convertSIToF64() const { if (type == Type::i32) return Literal(double(i32)); if (type == Type::i64) return Literal(double(i64)); WASM_UNREACHABLE(); } -Literal Literal::truncUIToF64() const { +Literal Literal::convertUIToF64() const { if (type == Type::i32) return Literal(double(uint32_t(i32))); if (type == Type::i64) return Literal(double(uint64_t(i64))); WASM_UNREACHABLE(); @@ -426,7 +421,7 @@ Literal Literal::demote() const { // when we must convert to infinity, do that if (f64 < -std::numeric_limits<float>::max()) return Literal(-std::numeric_limits<float>::infinity()); if (f64 > std::numeric_limits<float>::max()) return Literal(std::numeric_limits<float>::infinity()); - return truncateToF32(); + return Literal(float(getf64())); } Literal Literal::add(const Literal& other) const { |