From 75b693434b5af75d105af4900b5d0c6048155421 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Wed, 12 Dec 2018 14:11:04 -0800 Subject: Update wrap and demote literal op names (#1817) * Update literal op names * Remove `demoteToF32` in favor of `demote` --- src/wasm/literal.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/wasm/literal.cpp') 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::max()) return Literal(-std::numeric_limits::infinity()); if (f64 > std::numeric_limits::max()) return Literal(std::numeric_limits::infinity()); - return truncateToF32(); + return Literal(float(getf64())); } Literal Literal::add(const Literal& other) const { -- cgit v1.2.3