From 5f4a2860460c1954810be1af6daa419f655b8b5e Mon Sep 17 00:00:00 2001 From: lizzie Date: Sun, 31 May 2026 04:18:12 +0200 Subject: [dynarmic] cleanup duplicate code and reimpls of std::* bit stuff (#4017) A bit of a minor cleanup - std::rotr instead of mcl::bit::rotate_right - std::rotl likewise - std::popcount instaed of "count ones" - use ConvertRoundingModeToX64Immediate where appropiate - std integral Signed-off-by: lizzie Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4017 Reviewed-by: MaranBr Reviewed-by: crueter --- tools/gendynarm.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/gendynarm.cpp b/tools/gendynarm.cpp index 3d1588e7e8..3e28363a10 100644 --- a/tools/gendynarm.cpp +++ b/tools/gendynarm.cpp @@ -17,12 +17,6 @@ namespace mcl { template constexpr std::size_t bitsizeof = CHAR_BIT * sizeof(T); } -namespace mcl::bit { -template -inline size_t count_ones(T x) { - return std::bitset>(x).count(); -} -} template inline consteval std::array StringToArray(const char (&str)[N + 1]) { std::array result{}; @@ -380,7 +374,7 @@ INST(arm_SRS, "SRS", "1111100--1-0110100000101000----- }; // If a matcher has more bits in its mask it is more specific, so it should come first. std::stable_sort(list.begin(), list.end(), [](const auto& matcher1, const auto& matcher2) { - return mcl::bit::count_ones(matcher1.second) > mcl::bit::count_ones(matcher2.second); + return std::popcount(matcher1.second) > std::popcount(matcher2.second); }); for (auto const& e : list) printf("%s\n", e.inst_final); @@ -587,7 +581,7 @@ INST(v8_VLD_single, "VLD{1-4} (single)", "111101001D10nnnnddddzzN }); // If a matcher has more bits in its mask it is more specific, so it should come first. std::stable_sort(sort_begin, sort_end, [](const auto& a, const auto& b) { - return mcl::bit::count_ones(a.second) > mcl::bit::count_ones(b.second); + return std::popcount(a.second) > std::popcount(b.second); }); for (auto const& e : table) printf("%s\n", e.inst_final); @@ -1628,7 +1622,7 @@ INST(FNMSUB_float, "FNMSUB", "00011 // If a matcher has more bits in its mask it is more specific, so it should come first. std::stable_sort(list.begin(), list.end(), [](const auto& a, const auto& b) { // If a matcher has more bits in its mask it is more specific, so it should come first. - return mcl::bit::count_ones(a.second) > mcl::bit::count_ones(b.second); + return std::popcount(a.second) > std::popcount(b.second); }); // Exceptions to the above rule of thumb. std::stable_partition(list.begin(), list.end(), [&](const auto& e) { -- cgit v1.2.3