git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit b24c539432f6fda4512a5e1c532744981b27ef09
parent c3586ef7ca7755895e59678d251dfbb85c384359
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sun,  5 Oct 2025 02:16:19 +0300

Minor optimizations to Ch4

Diffstat:
MCore/apu.c5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Core/apu.c b/Core/apu.c @@ -990,10 +990,11 @@ restart:; cycles_left -= gb->apu.noise_channel.counter_countdown; gb->apu.noise_channel.counter_countdown = divisor + gb->apu.noise_channel.delta; gb->apu.noise_channel.delta = 0; - bool old_bit = (gb->apu.noise_channel.counter >> (gb->io_registers[GB_IO_NR43] >> 4)) & 1; + uint16_t mask = 1 << (gb->io_registers[GB_IO_NR43] >> 4); + bool old_bit = gb->apu.noise_channel.counter & mask; gb->apu.noise_channel.counter++; gb->apu.noise_channel.counter &= 0x3FFF; - bool new_bit = (gb->apu.noise_channel.counter >> (gb->io_registers[GB_IO_NR43] >> 4)) & 1; + bool new_bit = gb->apu.noise_channel.counter & mask; /* Step LFSR */ if (new_bit && !old_bit) {

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.