patch-2.2.18 linux/arch/arm/lib/strrchr.S

Next file: linux/arch/arm/lib/testchangebit.S
Previous file: linux/arch/arm/lib/string.S
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/arch/arm/lib/strrchr.S linux/arch/arm/lib/strrchr.S
@@ -0,0 +1,29 @@
+/*
+ * linux/arch/arm/lib/strrchr.S
+ *
+ * Copyright (C) 1995-1999 Russell King
+ *
+ * ASM optimised string functions
+ *
+ */
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+#include "constants.h"
+
+		.text
+
+		@ Technically this will fail a regression test that tries
+		@ strrchr (buffer, 0), by returning NULL rather than
+		@ buffer + strlen (buffer). But even glibc doesnt test this
+ENTRY(strrchr)	@ 2nd argument is int not char
+		stmfd	sp!, {lr}
+		mov	r3, r0
+		ldrb	r2, [r3], #1
+		mov	r0, #0		@ prime return result.
+1:		teq	r2, r1		@ Found one?
+		subeq	r0, r3, #1
+		teq	r2, #0
+		ldrneb	r2, [r3], #1	@ Assume that well be looping at least
+		bne	1b		@ twice, so put LDM outside loop.
+		LOADREGS(fd, sp!, {pc})
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)