From e08b851c79ae9a7fc0a2066e49110dc7fb426bce Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Mon, 28 Apr 2025 22:19:43 +0200 Subject: reverted rewrite of ppu, optimized what functions should be forced inline, gained ~2.5% performance --- cpu.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'cpu.c') diff --git a/cpu.c b/cpu.c index ec7b5ec..9f0639d 100644 --- a/cpu.c +++ b/cpu.c @@ -5,12 +5,12 @@ // REMOVE FOR NES!!!!! // #define ENABLE_DECIMAL_MODE -__attribute__((hot, always_inline)) +__attribute__((hot)) 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__((hot, always_inline)) +__attribute__((hot)) static inline void unpack_flags(struct cpu_state *cpu, uint8_t value) { cpu->n = (value >> 7) & 1; cpu->v = (value >> 6) & 1; @@ -28,10 +28,6 @@ static inline void update_zn(struct cpu_state *cpu, uint8_t result) { static void (*opcode_lut[256*2])(struct nes_state *) __attribute__((aligned(4096))); -struct addr_result { - uint32_t addr; - uint8_t value; -}; #include "cpu_opcodes.c" #include "cpu_opcodes_ud.c" @@ -75,7 +71,7 @@ static inline void do_irq(struct nes_state * restrict state) { cpu->i = 1; } -__attribute__((hot)) +__attribute__((always_inline, hot)) static inline void check_interrupts(struct nes_state * restrict state) { struct cpu_state * restrict cpu = &state->cpu; -- cgit v1.2.3