Skip to content

Commit

Permalink
SNES: Reduced binary size by ~20KB
Browse files Browse the repository at this point in the history
I refactored spc700.c:
- Replaced jump table by a switch. I'm aware that they're essentially the same thing (given our range), but the generated code is ~9KB less, so...
- Removed unnecessary inlining

Doesn't seem to have any performance impact, if anything it is marginally faster...

Possible improvements:
- Grouping identical instructions will reduce size further, but it might break the switch optimizations
- Finalizing the loop inside the function will certainly improve performance
  • Loading branch information
ducalex committed Feb 22, 2025
1 parent 5fe002e commit 66c194a
Show file tree
Hide file tree
Showing 3 changed files with 1,474 additions and 2,459 deletions.
1 change: 0 additions & 1 deletion retro-core/components/snes9x/src/apu.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ bool S9xInitSound(int32_t buffer_ms, int32_t lag_ms);
void S9xPrintAPUState(void);
extern uint8_t S9xAPUCycles [256]; /* Scaled cycle lengths */
extern const uint8_t S9xAPUCycleLengths [256]; /* Raw data. */
extern void (* const S9xApuOpcodes [256])(void);

#define APU_VOL_LEFT 0x00
#define APU_VOL_RIGHT 0x01
Expand Down
Loading

0 comments on commit 66c194a

Please sign in to comment.