From a9473915567e0636f60adb40f888e9895592613e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 26 Sep 2016 19:51:48 -0400 Subject: [PATCH 1/2] PPCAnalyst: Make local constants constexpr --- Source/Core/Core/PowerPC/PPCAnalyst.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index 69c95acd0b..97fc26b7eb 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -30,9 +30,9 @@ namespace PPCAnalyst { -static const int CODEBUFFER_SIZE = 32000; +constexpr int CODEBUFFER_SIZE = 32000; // 0 does not perform block merging -static const u32 FUNCTION_FOLLOWING_THRESHOLD = 16; +constexpr u32 FUNCTION_FOLLOWING_THRESHOLD = 16; CodeBuffer::CodeBuffer(int size) { From 082275d785e725504e82cc6cb1e1d2cd2af868bc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 26 Sep 2016 19:58:21 -0400 Subject: [PATCH 2/2] PPCAnalyst: Convert #define into a constant --- Source/Core/Core/PowerPC/PPCAnalyst.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index 97fc26b7eb..9f38df5ade 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -34,6 +34,8 @@ constexpr int CODEBUFFER_SIZE = 32000; // 0 does not perform block merging constexpr u32 FUNCTION_FOLLOWING_THRESHOLD = 16; +constexpr u32 INVALID_BRANCH_TARGET = 0xFFFFFFFF; + CodeBuffer::CodeBuffer(int size) { codebuffer = new PPCAnalyst::CodeOp[size]; @@ -45,8 +47,6 @@ CodeBuffer::~CodeBuffer() delete[] codebuffer; } -#define INVALID_TARGET ((u32)-1) - static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc) { switch (instr.OPCD) @@ -60,7 +60,7 @@ static u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc) return target; } default: - return INVALID_TARGET; + return INVALID_BRANCH_TARGET; } } @@ -168,7 +168,7 @@ bool AnalyzeFunction(u32 startAddr, Symbol& func, int max_size) else { u32 target = EvaluateBranchTarget(instr, addr); - if (target != INVALID_TARGET && instr.LK) + if (target != INVALID_BRANCH_TARGET && instr.LK) { // we found a branch-n-link! func.calls.emplace_back(target, addr);