Reduce mixer_collapse by 1 instruction

This commit is contained in:
Gwilym Kuiper 2021-07-31 22:01:20 +01:00
parent 8cffa4ae3d
commit f1b6b1035b

View file

@ -74,7 +74,7 @@ agb_rs__mixer_collapse:
@ r0 = target buffer (i8) @ r0 = target buffer (i8)
@ r1 = input buffer (i16) of fixnums with 4 bits of precision @ r1 = input buffer (i16) of fixnums with 4 bits of precision
mov r2, #0 mov r2, #352
1: 1:
@ r12 = *r1; r1++ @ r12 = *r1; r1++
@ -88,11 +88,9 @@ agb_rs__mixer_collapse:
cmp r12, #2048 @ compare r12 against 2048 cmp r12, #2048 @ compare r12 against 2048
movge r3, #127 @ r3 = 127 if r12 >= 2048 movge r3, #127 @ r3 = 127 if r12 >= 2048
strb r3, [r0, -r2] @ r2 counts down, so need a negative offset strb r3, [r0], #1 @ *r0 = r3; r0++
sub r2, r2, #1 @ r2 -= 1 subs r2, r2, #1 @ r2 -= 1
cmn r2, #352 @ compare r2 against -352 bne 1b @ loop if not 0
bne 1b @ loop if not equal
bx lr bx lr