summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/lib/memcmp.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/firmware/lib/memcmp.S')
-rw-r--r--src/target/firmware/lib/memcmp.S18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/target/firmware/lib/memcmp.S b/src/target/firmware/lib/memcmp.S
new file mode 100644
index 00000000..c60b170b
--- /dev/null
+++ b/src/target/firmware/lib/memcmp.S
@@ -0,0 +1,18 @@
+ .text
+ .code 32
+ .globl memcmp
+memcmp:
+ cmp r2, #0
+ beq zero_len_out
+ mov r3, r0
+1: ldrb r0, [r3], #1
+ ldrb r12, [r1], #1
+ subs r0, r0, r12
+ bxne lr
+ subs r2, r2, #1
+ bne 1b
+ bx lr
+
+zero_len_out:
+ mov r0, #0
+ bx lr