From 6f98434a185a31b123583ac2ead2c4c2a0ccf6f3 Mon Sep 17 00:00:00 2001 From: Myles Busig Date: Thu, 7 Mar 2024 15:53:10 -0700 Subject: [PATCH] Fix mtl_rmemcpy32 incorrectly calculating the number of bytes and words --- src/memcpy.s | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/memcpy.s b/src/memcpy.s index 0b4fccb..4d501f0 100644 --- a/src/memcpy.s +++ b/src/memcpy.s @@ -117,7 +117,7 @@ add r1, r2 sub r0, #1 sub r1, #1 // r12 = num residual bytes -and r12, r2, #3 +and r12, r2, #2 .Lrbyte_copy: subs r12, #1 ldrcsb r3, [r1], #-1 @@ -125,6 +125,7 @@ and r12, r2, #3 bhi .Lrbyte_copy // r12 = num residual words lsr r12, r2, #2 +and r12, #3 // Move to the beginning of the current word sub r0, #3 sub r1, #3