mirror of https://github.com/snes9xgit/snes9x.git
11% performance boost on x64 by reducing branches
This commit is contained in:
parent
a230f67567
commit
2cbb3f6cf7
12
cpuexec.h
12
cpuexec.h
|
@ -287,25 +287,25 @@ static inline void S9xFixCycles (void)
|
||||||
|
|
||||||
static inline void S9xCheckInterrupts (void)
|
static inline void S9xCheckInterrupts (void)
|
||||||
{
|
{
|
||||||
bool8 thisIRQ = PPU.HTimerEnabled || PPU.VTimerEnabled;
|
bool8 thisIRQ = PPU.HTimerEnabled | PPU.VTimerEnabled;
|
||||||
|
|
||||||
if (CPU.IRQLine && thisIRQ)
|
if (CPU.IRQLine & thisIRQ)
|
||||||
CPU.IRQTransition = TRUE;
|
CPU.IRQTransition = TRUE;
|
||||||
|
|
||||||
if (PPU.HTimerEnabled)
|
if (PPU.HTimerEnabled)
|
||||||
{
|
{
|
||||||
int32 htimepos = PPU.HTimerPosition;
|
int32 htimepos = PPU.HTimerPosition;
|
||||||
if (CPU.Cycles >= Timings.H_Max && htimepos < CPU.PrevCycles)
|
if (CPU.Cycles >= Timings.H_Max & htimepos < CPU.PrevCycles)
|
||||||
htimepos += Timings.H_Max;
|
htimepos += Timings.H_Max;
|
||||||
|
|
||||||
if (CPU.PrevCycles >= htimepos || CPU.Cycles < htimepos)
|
if (CPU.PrevCycles >= htimepos | CPU.Cycles < htimepos)
|
||||||
thisIRQ = FALSE;
|
thisIRQ = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PPU.VTimerEnabled)
|
if (PPU.VTimerEnabled)
|
||||||
{
|
{
|
||||||
int32 vcounter = CPU.V_Counter;
|
int32 vcounter = CPU.V_Counter;
|
||||||
if (CPU.Cycles >= Timings.H_Max && (!PPU.HTimerEnabled || PPU.HTimerPosition < CPU.PrevCycles)) {
|
if (CPU.Cycles >= Timings.H_Max & (!PPU.HTimerEnabled | PPU.HTimerPosition < CPU.PrevCycles)) {
|
||||||
vcounter++;
|
vcounter++;
|
||||||
if(vcounter >= Timings.V_Max)
|
if(vcounter >= Timings.V_Max)
|
||||||
vcounter = 0;
|
vcounter = 0;
|
||||||
|
@ -315,7 +315,7 @@ static inline void S9xCheckInterrupts (void)
|
||||||
thisIRQ = FALSE;
|
thisIRQ = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CPU.IRQLastState && thisIRQ)
|
if (!CPU.IRQLastState & thisIRQ)
|
||||||
{
|
{
|
||||||
#ifdef DEBUGGER
|
#ifdef DEBUGGER
|
||||||
S9xTraceFormattedMessage("--- /IRQ High->Low prev HC:%04d curr HC:%04d HTimer:%d Pos:%04d VTimer:%d Pos:%03d",
|
S9xTraceFormattedMessage("--- /IRQ High->Low prev HC:%04d curr HC:%04d HTimer:%d Pos:%04d VTimer:%d Pos:%03d",
|
||||||
|
|
Loading…
Reference in New Issue