summaryrefslogtreecommitdiff
path: root/cpu.c
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-04-07 19:47:27 +0200
committerPeter Fors <peter.fors@mindkiller.com>2025-04-07 19:47:27 +0200
commitd45fbf8d2e1adcb35043dfc9e06eae3ccfdf596e (patch)
treec450bc97b2b0e767150e07db745328944dcd1041 /cpu.c
parent5409798e800b6deb5d5874401a2925d1e18d8bd3 (diff)
cleanup and optimization tests, unfortunately nothing great.
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cpu.c b/cpu.c
index 34d5bed..ec7b5ec 100644
--- a/cpu.c
+++ b/cpu.c
@@ -5,12 +5,12 @@
// REMOVE FOR NES!!!!!
// #define ENABLE_DECIMAL_MODE
-__attribute__((always_inline))
+__attribute__((hot, always_inline))
static inline uint8_t pack_flags(struct cpu_state *cpu) {
return (cpu->n << 7) | (cpu->v << 6) | (1 << 5) | (cpu->d << 3) | (cpu->i << 2) | (cpu->z << 1) | cpu->c;
}
-__attribute__((always_inline))
+__attribute__((hot, always_inline))
static inline void unpack_flags(struct cpu_state *cpu, uint8_t value) {
cpu->n = (value >> 7) & 1;
cpu->v = (value >> 6) & 1;
@@ -20,6 +20,7 @@ static inline void unpack_flags(struct cpu_state *cpu, uint8_t value) {
cpu->c = value & 1;
}
+__attribute__((hot))
static inline void update_zn(struct cpu_state *cpu, uint8_t result) {
cpu->z = (result == 0);
cpu->n = (result & 0x80) != 0;