PPCAnalyst: Mark some functions as const

Also removes the redundant inline specifier, as functions defined in a class/struct definition are inline by default.
This commit is contained in:
Lioncash 2015-06-04 19:11:27 -04:00
parent e70c9b44f5
commit 293c3bae6f
1 changed files with 13 additions and 9 deletions

View File

@ -79,19 +79,23 @@ struct BlockRegStats
bool any; bool any;
bool anyTimer; bool anyTimer;
int GetTotalNumAccesses(int reg) {return numReads[reg] + numWrites[reg];} int GetTotalNumAccesses(int reg) const
int GetUseRange(int reg)
{ {
return std::max(lastRead[reg], lastWrite[reg]) - return numReads[reg] + numWrites[reg];
std::min(firstRead[reg], firstWrite[reg]);
} }
bool IsUsed(int reg) int GetUseRange(int reg) const
{
return std::max(lastRead[reg], lastWrite[reg]) -
std::min(firstRead[reg], firstWrite[reg]);
}
bool IsUsed(int reg) const
{ {
return (numReads[reg] + numWrites[reg]) > 0; return (numReads[reg] + numWrites[reg]) > 0;
} }
inline void SetInputRegister(int reg, short opindex) void SetInputRegister(int reg, short opindex)
{ {
if (firstRead[reg] == -1) if (firstRead[reg] == -1)
firstRead[reg] = opindex; firstRead[reg] = opindex;
@ -99,7 +103,7 @@ struct BlockRegStats
numReads[reg]++; numReads[reg]++;
} }
inline void SetOutputRegister(int reg, short opindex) void SetOutputRegister(int reg, short opindex)
{ {
if (firstWrite[reg] == -1) if (firstWrite[reg] == -1)
firstWrite[reg] = opindex; firstWrite[reg] = opindex;
@ -107,7 +111,7 @@ struct BlockRegStats
numWrites[reg]++; numWrites[reg]++;
} }
inline void Clear() void Clear()
{ {
for (int i = 0; i < 32; ++i) for (int i = 0; i < 32; ++i)
{ {
@ -225,7 +229,7 @@ public:
// Option setting/getting // Option setting/getting
void SetOption(AnalystOption option) { m_options |= option; } void SetOption(AnalystOption option) { m_options |= option; }
void ClearOption(AnalystOption option) { m_options &= ~(option); } void ClearOption(AnalystOption option) { m_options &= ~(option); }
bool HasOption(AnalystOption option) { return !!(m_options & option); } bool HasOption(AnalystOption option) const { return !!(m_options & option); }
u32 Analyze(u32 address, CodeBlock *block, CodeBuffer *buffer, u32 blockSize); u32 Analyze(u32 address, CodeBlock *block, CodeBuffer *buffer, u32 blockSize);
}; };