From ddc4e7484b4c09718ac8dd24d25a862c82f8f4a4 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 10 May 2019 22:29:30 +0300 Subject: [PATCH] Fix and restore optimization --- Core/apu.c | 5 +++-- Makefile | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/apu.c b/Core/apu.c index e437718..a0b9aa1 100644 --- a/Core/apu.c +++ b/Core/apu.c @@ -70,7 +70,8 @@ static void render(GB_gameboy_t *gb, bool no_downsampling, GB_sample_t *dest) { GB_sample_t output = {0,0}; - for (unsigned i = GB_N_CHANNELS; i--;) { + UNROLL + for (unsigned i = 0; i < GB_N_CHANNELS; i++) { double multiplier = CH_STEP; if (!is_DAC_enabled(gb, i)) { gb->apu_output.dac_discharge[i] -= ((double) DAC_DECAY_SPEED) / gb->apu_output.sample_rate; @@ -375,7 +376,7 @@ void GB_apu_run(GB_gameboy_t *gb) } UNROLL - for (unsigned i = GB_SQUARE_2 + 1; i--;) { + for (unsigned i = GB_SQUARE_1; i <= GB_SQUARE_2; i++) { if (gb->apu.is_active[i]) { uint8_t cycles_left = cycles; while (unlikely(cycles_left > gb->apu.square_channels[i].sample_countdown)) { diff --git a/Makefile b/Makefile index dec3a91..5a9f9b5 100644 --- a/Makefile +++ b/Makefile @@ -204,7 +204,7 @@ $(BIN)/SameBoy.app/Contents/MacOS/SameBoy: $(CORE_OBJECTS) $(COCOA_OBJECTS) -@$(MKDIR) -p $(dir $@) $(CC) $^ -o $@ $(LDFLAGS) -framework OpenGL -framework AudioUnit -framework AVFoundation -framework CoreVideo -framework CoreMedia -framework IOKit ifeq ($(CONF), release) - #strip $@ + strip $@ endif $(BIN)/SameBoy.app/Contents/Resources/Base.lproj/%.nib: Cocoa/%.xib