CoreTiming: make loops easier to read

This commit is contained in:
Tillmann Karras 2015-08-26 14:53:58 +02:00
parent a36b135473
commit 0f4861cac2
1 changed files with 11 additions and 28 deletions

View File

@ -324,22 +324,12 @@ bool IsScheduled(int event_type)
void RemoveEvent(int event_type) void RemoveEvent(int event_type)
{ {
if (!first) while (first && first->type == event_type)
return;
while (first)
{
if (first->type == event_type)
{ {
Event* next = first->next; Event* next = first->next;
FreeEvent(first); FreeEvent(first);
first = next; first = next;
} }
else
{
break;
}
}
if (!first) if (!first)
return; return;
@ -434,9 +424,7 @@ void Advance()
lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f; lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f;
PowerPC::ppcState.downcount = CyclesToDowncount(slicelength); PowerPC::ppcState.downcount = CyclesToDowncount(slicelength);
while (first) while (first && first->time <= globalTimer)
{
if (first->time <= globalTimer)
{ {
//LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ", //LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ",
// event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time); // event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time);
@ -445,11 +433,6 @@ void Advance()
event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time)); event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
FreeEvent(evt); FreeEvent(evt);
} }
else
{
break;
}
}
if (!first) if (!first)
{ {