RegisterView: Get rid of explicit memsets in CRegTable's constructor

Also gets rid of an unnecessary fill.

This is done by just default initializing the arrays
This commit is contained in:
Lioncash
2016-09-30 01:11:52 -04:00
parent 212cf4c791
commit 567d0204dd
2 changed files with 7 additions and 16 deletions

View File

@ -220,17 +220,8 @@ bool TryParseGPR(wxString str, CRegTable::FormatSpecifier format, u32* value)
CRegTable::CRegTable() CRegTable::CRegTable()
{ {
m_formatRegs.fill(FormatSpecifier::Hex8);
for (auto& entry : m_formatFRegs) for (auto& entry : m_formatFRegs)
entry.fill(FormatSpecifier::Hex16); entry.fill(FormatSpecifier::Hex16);
memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
memset(m_CachedSpecialRegs, 0, sizeof(m_CachedSpecialRegs));
memset(m_CachedFRegs, 0, sizeof(m_CachedFRegs));
memset(m_CachedRegHasChanged, 0, sizeof(m_CachedRegHasChanged));
memset(m_CachedSpecialRegHasChanged, 0, sizeof(m_CachedSpecialRegHasChanged));
memset(m_CachedFRegHasChanged, 0, sizeof(m_CachedFRegHasChanged));
} }
wxString CRegTable::FormatGPR(int reg_index) wxString CRegTable::FormatGPR(int reg_index)

View File

@ -53,13 +53,13 @@ public:
private: private:
static constexpr size_t NUM_SPECIALS = 14; static constexpr size_t NUM_SPECIALS = 14;
u32 m_CachedRegs[32]; std::array<u32, 32> m_CachedRegs{};
u32 m_CachedSpecialRegs[NUM_SPECIALS]; std::array<u32, NUM_SPECIALS> m_CachedSpecialRegs{};
u64 m_CachedFRegs[32][2]; std::array<std::array<u64, 2>, 32> m_CachedFRegs{};
bool m_CachedRegHasChanged[32]; std::array<bool, 32> m_CachedRegHasChanged{};
bool m_CachedSpecialRegHasChanged[NUM_SPECIALS]; std::array<bool, NUM_SPECIALS> m_CachedSpecialRegHasChanged{};
bool m_CachedFRegHasChanged[32][2]; std::array<std::array<bool, 2>, 32> m_CachedFRegHasChanged{};
std::array<FormatSpecifier, 32> m_formatRegs; std::array<FormatSpecifier, 32> m_formatRegs{};
std::array<std::array<FormatSpecifier, 2>, 32> m_formatFRegs; std::array<std::array<FormatSpecifier, 2>, 32> m_formatFRegs;
wxString FormatGPR(int reg_index); wxString FormatGPR(int reg_index);