mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-03-01 18:29:32 +00:00
Add some performance hints to conditionals.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
412a44fafd
commit
8e4030a5aa
@ -162,14 +162,14 @@ namespace EightBit {
|
||||
}
|
||||
|
||||
uint8_t AM_AbsoluteX() {
|
||||
if (Address_AbsoluteX())
|
||||
if (UNLIKELY(Address_AbsoluteX()))
|
||||
addCycle();
|
||||
BUS().ADDRESS() = MEMPTR();
|
||||
return getByte();
|
||||
}
|
||||
|
||||
uint8_t AM_AbsoluteY() {
|
||||
if (Address_AbsoluteY())
|
||||
if (UNLIKELY(Address_AbsoluteY()))
|
||||
addCycle();
|
||||
BUS().ADDRESS() = MEMPTR();
|
||||
return getByte();
|
||||
@ -191,7 +191,7 @@ namespace EightBit {
|
||||
}
|
||||
|
||||
uint8_t AM_IndirectIndexedY() {
|
||||
if (Address_IndirectIndexedY())
|
||||
if (UNLIKELY(Address_IndirectIndexedY()))
|
||||
addCycle();
|
||||
BUS().ADDRESS() = MEMPTR();
|
||||
return getByte();
|
||||
|
@ -336,7 +336,7 @@ int EightBit::MOS6502::execute(uint8_t cell) {
|
||||
__assume(0);
|
||||
}
|
||||
|
||||
if (cycles() == 0)
|
||||
if (UNLIKELY(cycles() == 0))
|
||||
throw std::logic_error("Unhandled opcode");
|
||||
|
||||
return cycles();
|
||||
@ -480,7 +480,7 @@ void EightBit::MOS6502::ADC_d(uint8_t data) {
|
||||
void EightBit::MOS6502::Branch(int8_t displacement) {
|
||||
const auto page = PC().high;
|
||||
PC().word += displacement;
|
||||
if (PC().high != page)
|
||||
if (UNLIKELY(PC().high != page))
|
||||
addCycle();
|
||||
addCycle();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user