DSPTables: Deduplicate FindByOpcode() implementations in DSP opcode tables
This function was duplicated across all the opcode tables: the main info tables, the interpreter tables, and the x86-64 JIT tables. However, we can just make the type of the std::array parameter a template type and get rid of this duplication.
This commit is contained in:
1 parent
77f6e50493
commit
fd1ad02c5c
4 files changed
+13
-26
No files matched your search
@@ -510,14 +510,6 @@ constexpr size_t EXT_OPTABLE_SIZE = 0xff + 1;
|
||||
std::array<const DSPOPCTemplate*, OPTABLE_SIZE> s_op_table;
|
||||
std::array<const DSPOPCTemplate*, EXT_OPTABLE_SIZE> s_ext_op_table;
|
||||
|
||||
template <size_t N>
|
||||
auto FindByOpcode(UDSPInstruction opcode, const std::array<DSPOPCTemplate, N>& data)
|
||||
{
|
||||
return std::find_if(data.cbegin(), data.cend(), [opcode](const auto& info) {
|
||||
return (opcode & info.opcode_mask) == info.opcode;
|
||||
});
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
auto FindByName(const std::string& name, const std::array<DSPOPCTemplate, N>& data)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user