changeset 95:3670e7768ab6

target-utils/libc: strlen optimized assembly implementation added
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 31 Oct 2016 22:14:38 +0000
parents cbc6bc05d494
children d8d03dafb9c0
files target-utils/libc/Makefile target-utils/libc/strlen.S
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/libc/Makefile	Mon Oct 31 21:33:05 2016 +0000
+++ b/target-utils/libc/Makefile	Mon Oct 31 22:14:38 2016 +0000
@@ -5,8 +5,8 @@
 RANLIB=	arm-elf-ranlib
 
 OBJS=	atoi.o bzero.o ctype_.o index.o memcmp.o memcpy.o memcpy16.o memcpy32.o\
-	memset.o rindex.o strcasecmp.o strcat.o strcmp.o strcpy.o strncat.o \
-	strncmp.o strncpy.o
+	memset.o rindex.o strcasecmp.o strcat.o strcmp.o strcpy.o strlen.o \
+	strncat.o strncmp.o strncpy.o
 
 all:	libc.a
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/libc/strlen.S	Mon Oct 31 22:14:38 2016 +0000
@@ -0,0 +1,10 @@
+	.text
+	.code	32
+	.globl	strlen
+strlen:
+	mov	r1, r0
+1:	ldrb	r2, [r0], #1
+	cmn	r2, #0
+	bne	1b
+	sbc	r0, r0, r1
+	bx	lr