diff --git a/src/backend/x64/emit_x64_floating_point.cpp b/src/backend/x64/emit_x64_floating_point.cpp index 8f515849..fb23b752 100644 --- a/src/backend/x64/emit_x64_floating_point.cpp +++ b/src/backend/x64/emit_x64_floating_point.cpp @@ -857,14 +857,11 @@ static void EmitFPRound(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst, siz >; using exact_list = mp::list; - using key_type = std::tuple; - using value_type = u64(*)(u64, FP::FPSR&, FP::FPCR); - - static const auto lut = Common::GenerateLookupTableFromList( + static const auto lut = Common::GenerateLookupTableFromList( [](auto args) { - return std::pair{ + return std::pair{ mp::lower_to_tuple_v, - static_cast( + static_cast( [](u64 input, FP::FPSR& fpsr, FP::FPCR fpcr) { constexpr auto t = mp::lower_to_tuple_v; constexpr size_t fsize = std::get<0>(t); @@ -1288,14 +1285,11 @@ static void EmitFPToFixed(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) { mp::lift_value >; - using key_type = std::tuple; - using value_type = u64(*)(u64, FP::FPSR&, FP::FPCR); - - static const auto lut = Common::GenerateLookupTableFromList( + static const auto lut = Common::GenerateLookupTableFromList( [](auto args) { - return std::pair{ + return std::pair{ mp::lower_to_tuple_v, - static_cast( + static_cast( [](u64 input, FP::FPSR& fpsr, FP::FPCR fpcr) { constexpr auto t = mp::lower_to_tuple_v; constexpr size_t fbits = std::get<0>(t); diff --git a/src/backend/x64/emit_x64_vector_floating_point.cpp b/src/backend/x64/emit_x64_vector_floating_point.cpp index 4af99cf9..810213aa 100644 --- a/src/backend/x64/emit_x64_vector_floating_point.cpp +++ b/src/backend/x64/emit_x64_vector_floating_point.cpp @@ -1213,14 +1213,11 @@ void EmitFPVectorRoundInt(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) { >; using exact_list = mp::list; - using key_type = std::tuple; - using value_type = void(*)(VectorArray&, const VectorArray&, FP::FPCR, FP::FPSR&); - - static const auto lut = Common::GenerateLookupTableFromList( + static const auto lut = Common::GenerateLookupTableFromList( [](auto arg) { - return std::pair{ + return std::pair{ mp::lower_to_tuple_v, - static_cast( + static_cast&, const VectorArray&, FP::FPCR, FP::FPSR&)>( [](VectorArray& output, const VectorArray& input, FP::FPCR fpcr, FP::FPSR& fpsr) { constexpr auto t = mp::lower_to_tuple_v; constexpr FP::RoundingMode rounding_mode = std::get<0>(t); @@ -1475,14 +1472,11 @@ void EmitFPVectorToFixed(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) { mp::lift_value >; - using key_type = std::tuple; - using value_type = void(*)(VectorArray&, const VectorArray&, FP::FPCR, FP::FPSR&); - - static const auto lut = Common::GenerateLookupTableFromList( + static const auto lut = Common::GenerateLookupTableFromList( [](auto arg) { - return std::pair{ + return std::pair{ mp::lower_to_tuple_v, - static_cast( + static_cast&, const VectorArray&, FP::FPCR, FP::FPSR&)>( [](VectorArray& output, const VectorArray& input, FP::FPCR fpcr, FP::FPSR& fpsr) { constexpr auto t = mp::lower_to_tuple_v; constexpr size_t fbits = std::get<0>(t); diff --git a/src/common/lut_from_list.h b/src/common/lut_from_list.h index 845a7f38..676de175 100644 --- a/src/common/lut_from_list.h +++ b/src/common/lut_from_list.h @@ -6,17 +6,33 @@ #pragma once -#include +#include #include +#include +#include +#include #include +#ifdef _MSC_VER +#include +#endif + namespace Dynarmic::Common { -template +template inline auto GenerateLookupTableFromList(Function f, mp::list) { - static const std::array, sizeof...(Values)> pair_array{f(Values{})...}; - return std::map(pair_array.begin(), pair_array.end()); +#ifdef _MSC_VER + using PairT = std::invoke_result_t>>; +#else + using PairT = std::common_type_t...>; +#endif + using MapT = mp::apply; + + static_assert(mp::is_instance_of_template_v); + + const std::initializer_list pair_array{f(Values{})...}; + return MapT(pair_array.begin(), pair_array.end()); } } // namespace Dynarmic::Common