From dc41d64151356a9ab760e336a10d264797f1dfcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 15 Jul 2020 18:12:17 +0200 Subject: [PATCH] Simplify {unary,binary}_op() implementation --- lib/fizzy/execute.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/fizzy/execute.cpp b/lib/fizzy/execute.cpp index 4d59682d7..1aa84002c 100644 --- a/lib/fizzy/execute.cpp +++ b/lib/fizzy/execute.cpp @@ -361,17 +361,17 @@ inline bool store_into_memory( template inline void unary_op(OperandStack& stack, Op op) noexcept { - using T = decltype(op(stack.top())); - stack.top() = op(static_cast(stack.top())); + using T = decltype(op({})); + stack.top() = op(stack.top().as()); } template inline void binary_op(OperandStack& stack, Op op) noexcept { - using T = decltype(op(stack.top(), stack.top())); - const auto val2 = static_cast(stack.pop()); - const auto val1 = static_cast(stack.top()); - stack.top() = static_cast>(op(val1, val2)); + using T = decltype(op({}, {})); + const auto val2 = stack.pop().as(); + const auto val1 = stack.top().as(); + stack.top() = op(val1, val2); } template class Op>