From 0f4861cac2138211bc322852686dc49033403f06 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Wed, 26 Aug 2015 14:53:58 +0200 Subject: [PATCH] CoreTiming: make loops easier to read --- Source/Core/Core/CoreTiming.cpp | 39 ++++++++++----------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index e52d49cbe5..deaae43830 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -324,21 +324,11 @@ bool IsScheduled(int event_type) void RemoveEvent(int event_type) { - if (!first) - return; - - while (first) + while (first && first->type == event_type) { - if (first->type == event_type) - { - Event *next = first->next; - FreeEvent(first); - first = next; - } - else - { - break; - } + Event* next = first->next; + FreeEvent(first); + first = next; } if (!first) @@ -434,21 +424,14 @@ void Advance() lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f; PowerPC::ppcState.downcount = CyclesToDowncount(slicelength); - while (first) + while (first && first->time <= globalTimer) { - if (first->time <= globalTimer) - { - //LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ", - // event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time); - Event* evt = first; - first = first->next; - event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time)); - FreeEvent(evt); - } - else - { - break; - } + //LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ", + // event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time); + Event* evt = first; + first = first->next; + event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time)); + FreeEvent(evt); } if (!first)