diff --git a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp index 8543313bc6a..0a0539f2dd3 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp +++ b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.cpp @@ -489,51 +489,6 @@ double BytecodeInterpreter::read_value(ReadonlyBytes data) return bit_cast(static_cast(raw_value)); } -template -MakeSigned BytecodeInterpreter::checked_signed_truncate(V value) -{ - if (isnan(value) || isinf(value)) { // "undefined", let's just trap. - m_trap = Trap { "Signed truncation undefined behavior" }; - return 0; - } - - double truncated; - if constexpr (IsSame) - truncated = truncf(value); - else - truncated = trunc(value); - - using SignedT = MakeSigned; - if (NumericLimits::min() <= truncated && static_cast(NumericLimits::max()) >= truncated) - return static_cast(truncated); - - dbgln_if(WASM_TRACE_DEBUG, "Truncate out of range error"); - m_trap = Trap { "Signed truncation out of range" }; - return true; -} - -template -MakeUnsigned BytecodeInterpreter::checked_unsigned_truncate(V value) -{ - if (isnan(value) || isinf(value)) { // "undefined", let's just trap. - m_trap = Trap { "Unsigned truncation undefined behavior" }; - return 0; - } - double truncated; - if constexpr (IsSame) - truncated = truncf(value); - else - truncated = trunc(value); - - using UnsignedT = MakeUnsigned; - if (NumericLimits::min() <= truncated && static_cast(NumericLimits::max()) >= truncated) - return static_cast(truncated); - - dbgln_if(WASM_TRACE_DEBUG, "Truncate out of range error"); - m_trap = Trap { "Unsigned truncation out of range" }; - return true; -} - Vector BytecodeInterpreter::pop_values(Configuration& configuration, size_t count) { Vector results; diff --git a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h index e7f376e5b4b..754c3b2529c 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h +++ b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h @@ -77,12 +77,6 @@ protected: template void unary_operation(Configuration&, Args&&...); - template - MakeUnsigned checked_unsigned_truncate(V); - - template - MakeSigned checked_signed_truncate(V); - template T read_value(ReadonlyBytes data);