Skip to content

Commit 4418bb4

Browse files
committed
memset: Correct behaviour for n > 255
Thanks to @geoffstreeter for spotting that I wasn't masking off bits 8-31 of n before replicating it across the word.
1 parent f6a1186 commit 4418bb4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

memset.S

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ myfunc memset
5757
DAT2 .req ip
5858
DAT3 .req lr
5959

60-
orr DAT0, DAT0, lsl #8
60+
and DAT0, DAT0, #255
6161
push {S, lr}
62+
orr DAT0, DAT0, lsl #8
6263
orr DAT0, DAT0, lsl #16
6364
mov DAT1, DAT0
6465

0 commit comments

Comments
 (0)