From e738acbe3c8d466a7240bc39efdff092c972d44f Mon Sep 17 00:00:00 2001 From: Akash Date: Tue, 2 Aug 2016 21:27:50 +0530 Subject: [PATCH] R5900: Minor clean up (no functional change) * Rename some variables as the previous names didn't make much sense. * Convert unnecessary int data types to bool. --- pcsx2/x86/ix86-32/iR5900-32.cpp | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 3aa7a09892..7b439ed2bd 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -569,7 +569,7 @@ static __aligned16 u8 manual_counter[Ps2MemSize::MainRam >> 12]; static std::atomic eeRecIsReset(false); static std::atomic eeRecNeedsReset(false); static bool eeCpuExecuting = false; -static int g_resetEeScalingStats = 0; +static bool g_resetEeScalingStats = false; static int g_patchesNeedRedo = 0; //////////////////////////////////////////////////// @@ -606,8 +606,7 @@ static void recResetRaw() recConstBufPtr = recConstBuf; g_branch = 0; - g_resetEeScalingStats = 1; - + g_resetEeScalingStats = true; g_patchesNeedRedo = 1; } @@ -957,16 +956,16 @@ void iFlushCall(int flushtype) // s_nBlockCycles is 3 bit fixed point. Divide by 8 when done! // Scaling blocks under 40 cycles seems to produce countless problem, so let's try to avoid them. -#define DEFAULT_SCALING_UNSANITIZED() (s_nBlockCycles >> 3) /* unsanitized sinec we don't check if 0 */ +#define DEFAULT_SCALED_BLOCKS() (s_nBlockCycles >> 3) -static u32 scaleblockcycles_calc() +static u32 scaleblockcycles_calculation() { bool lowcycles = (s_nBlockCycles <= 40); s8 cyclerate = EmuConfig.Speedhacks.EECycleRate; u32 scale_cycles = 0; if (cyclerate == 0 || lowcycles || cyclerate < -99 || cyclerate > 2) - scale_cycles = DEFAULT_SCALING_UNSANITIZED(); // Default cycle rate, could be 0 + scale_cycles = DEFAULT_SCALED_BLOCKS(); else if (cyclerate > 0) scale_cycles = s_nBlockCycles >> (3 + cyclerate); @@ -982,24 +981,26 @@ static u32 scaleblockcycles_calc() return (scale_cycles < 1) ? 1 : scale_cycles; } -static u32 scaleblockcycles() { - u32 scaled = scaleblockcycles_calc(); +static u32 scaleblockcycles() +{ + u32 scaled = scaleblockcycles_calculation(); -#if 0 /* Enable this to get some runtime statistics about the scaling result in practuce */ - static u32 scaled_overal = 0, unscaled_overal = 0; - if (g_resetEeScalingStats) { - scaled_overal = unscaled_overal = 0; - g_resetEeScalingStats = 0; +#if 0 // Enable this to get some runtime statistics about the scaling result in practice + static u32 scaled_overall = 0, unscaled_overall = 0; + if (g_resetEeScalingStats) + { + scaled_overall = unscaled_overall = 0; + g_resetEeScalingStats = false; } - u32 unscaled = DEFAULT_SCALING_UNSANITIZED(); + u32 unscaled = DEFAULT_SCALED_BLOCKS(); if (!unscaled) unscaled = 1; - scaled_overal += scaled; - unscaled_overal += unscaled; - float ratio = (float)unscaled_overal / scaled_overal; + scaled_overall += scaled; + unscaled_overall += unscaled; + float ratio = static_cast(unscaled_overall) / scaled_overall; - DevCon.WriteLn(L"Unscaled overal: %d, scaled overal: %d, relative EE clock speed: %d %%", - unscaled_overal, scaled_overal, (int)(100 * ratio)); + DevCon.WriteLn(L"Unscaled overall: %d, scaled overall: %d, relative EE clock speed: %d %%", + unscaled_overall, scaled_overall, static_cast(100 * ratio)); #endif return scaled;