Module Name:    src
Committed By:   matt
Date:           Mon Jan 28 06:23:15 UTC 2013

Modified Files:
        src/common/lib/libc/arch/arm/string: strrchr_arm.S

Log Message:
Deal with an end-of-string condition properly.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/strrchr_arm.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/arch/arm/string/strrchr_arm.S
diff -u src/common/lib/libc/arch/arm/string/strrchr_arm.S:1.1 src/common/lib/libc/arch/arm/string/strrchr_arm.S:1.2
--- src/common/lib/libc/arch/arm/string/strrchr_arm.S:1.1	Tue Jan 15 08:52:27 2013
+++ src/common/lib/libc/arch/arm/string/strrchr_arm.S	Mon Jan 28 06:23:14 2013
@@ -29,7 +29,7 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: strrchr_arm.S,v 1.1 2013/01/15 08:52:27 matt Exp $")
+RCSID("$NetBSD: strrchr_arm.S,v 1.2 2013/01/28 06:23:14 matt Exp $")
 
 #ifdef __ARMEL__
 #define	BYTE0	0x000000ff
@@ -94,6 +94,8 @@ ENTRY(strrchr)
 	 * Copy the NUL bit to the following byte lanes.  Then clear any match
 	 * bits in those byte lanes to prevent false positives in those bytes.
 	 */
+	bics	r5, r5, r4		/* clear any NUL match bits */
+	beq	.Ldone			/*   no remaining matches, we're done */
 	movs	r3, r4, lshi #8		/* shift up a byte */
 	orrnes	r3, r3, r3, lshi #8	/* if non 0, copy up to next byte */
 	orrnes	r3, r3, r3, lshi #8	/* if non 0, copy up to last byte */

Reply via email to