FreeCalypso > hg > freecalypso-tools
comparison target-utils/libc/memcmp.S @ 93:a675cec34076
target-utils/libc: assembly implementation of bcmp/memcmp
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 29 Oct 2016 00:15:12 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
92:bfed7a5c21a6 | 93:a675cec34076 |
---|---|
1 .text | |
2 .code 32 | |
3 .globl bcmp | |
4 .globl memcmp | |
5 bcmp: | |
6 memcmp: | |
7 cmp r2, #0 | |
8 beq zero_len_out | |
9 mov r3, r0 | |
10 1: ldrb r0, [r3], #1 | |
11 ldrb r12, [r1], #1 | |
12 subs r0, r0, r12 | |
13 bxne lr | |
14 subs r2, r2, #1 | |
15 bne 1b | |
16 bx lr | |
17 | |
18 zero_len_out: | |
19 mov r0, #0 | |
20 bx lr |