summaryrefslogtreecommitdiff
path: root/cpu.c
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-04-28 22:19:43 +0200
committerPeter Fors <peter.fors@mindkiller.com>2025-04-28 22:19:43 +0200
commite08b851c79ae9a7fc0a2066e49110dc7fb426bce (patch)
treec8458daee7201983903cf04413ff9a6072084028 /cpu.c
parentc40f7421d8c1ccbe008dbd2191c6642625ae4b83 (diff)
reverted rewrite of ppu, optimized what functions should be forced inline, gained ~2.5% performance
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c10
1 files changed, 3 insertions, 7 deletions
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;