From e6466c4d252c4b9d6a91da9c98a43183f32d2eb3 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Tue, 9 Jul 2024 22:40:24 -0400 Subject: [PATCH] Unroll accumulator loops Co-Authored-By: Evan Ramos <1585791+hendricks266@users.noreply.github.com> --- src/sound/snd_opl_nuked.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/sound/snd_opl_nuked.c b/src/sound/snd_opl_nuked.c index baeb9da47..23da37a07 100644 --- a/src/sound/snd_opl_nuked.c +++ b/src/sound/snd_opl_nuked.c @@ -1277,7 +1277,6 @@ nuked_generate(void *priv, int32_t *bufp) int16_t accm; int16_t shift = 0; uint8_t i; - uint8_t j; bufp[1] = dev->mixbuff[1]; @@ -1294,9 +1293,7 @@ nuked_generate(void *priv, int32_t *bufp) for (i = 0; i < 18; i++) { ch = &dev->chan[i]; out = ch->out; - for (j = 0; j < 4; j++) - accm += *out[j]; - + accm = *out[0] + *out[1] + *out[2] + *out[3]; mix += (int16_t) (accm & ch->cha); } @@ -1325,11 +1322,7 @@ nuked_generate(void *priv, int32_t *bufp) for (i = 0; i < 18; i++) { ch = &dev->chan[i]; out = ch->out; - accm = 0; - - for (j = 0; j < 4; j++) - accm += *out[j]; - + accm = *out[0] + *out[1] + *out[2] + *out[3]; mix += (int16_t) (accm & ch->chb); }