Merge pull request #4251 from lioncash/define

PPCAnalyst: Convert #define into a constant
This commit is contained in:
Markus Wick 2016-09-27 12:19:18 +02:00 committed by GitHub
commit f701724ee7
1 changed files with 6 additions and 6 deletions

View File

@ -30,9 +30,11 @@
namespace PPCAnalyst namespace PPCAnalyst
{ {
static const int CODEBUFFER_SIZE = 32000; constexpr int CODEBUFFER_SIZE = 32000;
// 0 does not perform block merging // 0 does not perform block merging
static const u32 FUNCTION_FOLLOWING_THRESHOLD = 16; constexpr u32 FUNCTION_FOLLOWING_THRESHOLD = 16;
constexpr u32 INVALID_BRANCH_TARGET = 0xFFFFFFFF;
CodeBuffer::CodeBuffer(int size) CodeBuffer::CodeBuffer(int size)
{ {
@ -45,8 +47,6 @@ CodeBuffer::~CodeBuffer()
delete[] codebuffer; delete[] codebuffer;
} }
#define INVALID_TARGET ((u32)-1)
static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc) static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc)
{ {
switch (instr.OPCD) switch (instr.OPCD)
@ -60,7 +60,7 @@ static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc)
return target; return target;
} }
default: default:
return INVALID_TARGET; return INVALID_BRANCH_TARGET;
} }
} }
@ -168,7 +168,7 @@ bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size)
else else
{ {
u32 target = EvaluateBranchTarget(instr, addr); u32 target = EvaluateBranchTarget(instr, addr);
if (target != INVALID_TARGET && instr.LK) if (target != INVALID_BRANCH_TARGET && instr.LK)
{ {
// we found a branch-n-link! // we found a branch-n-link!
func.calls.emplace_back(target, addr); func.calls.emplace_back(target, addr);