Couple of small changes in LIKELY/UNLIKELY usage.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2017-12-05 21:40:23 +00:00
parent 6a47f710b9
commit 3d88a8f6d1
2 changed files with 7 additions and 7 deletions

View File

@ -297,7 +297,7 @@ int EightBit::Intel8080::execute(uint8_t opcode) {
execute(x, y, z, p, q);
if (cycles() == 0)
if (UNLIKELY(cycles() == 0))
throw std::logic_error("Unhandled opcode");
return cycles();
@ -416,13 +416,13 @@ void EightBit::Intel8080::execute(int x, int y, int z, int p, int q) {
decrement(f, operand);
R(y, a, operand);
addCycles(4);
if (y == 6)
if (UNLIKELY(y == 6))
addCycles(7);
break;
} case 6: // 8-bit load immediate
R(y, a, fetchByte());
addCycles(7);
if (y == 6)
if (UNLIKELY(y == 6))
addCycles(3);
break;
case 7: // Assorted operations on accumulator/flags
@ -461,11 +461,11 @@ void EightBit::Intel8080::execute(int x, int y, int z, int p, int q) {
}
break;
case 1: // 8-bit loading
if (z == 6 && y == 6) { // Exception (replaces LD (HL), (HL))
if (UNLIKELY(z == 6 && y == 6)) { // Exception (replaces LD (HL), (HL))
halt();
} else {
R(y, a, R(z, a));
if ((y == 6) || (z == 6)) // M operations
if (UNLIKELY((y == 6) || (z == 6))) // M operations
addCycles(3);
}
addCycles(4);
@ -500,7 +500,7 @@ void EightBit::Intel8080::execute(int x, int y, int z, int p, int q) {
UNREACHABLE;
}
addCycles(4);
if (z == 6)
if (UNLIKELY(z == 6))
addCycles(3);
break;
case 3:

View File

@ -175,7 +175,7 @@ namespace EightBit {
HL2().low = value;
break;
case 6:
setByte(LIKELY(!m_displaced) ? HL().word : displacedAddress(), value);
setByte(LIKELY(!m_displaced) ? HL().word : displacedAddress(), value);
break;
case 7:
a = value;