Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/arch/arm/string Fix case when searching for ...
details: https://anonhg.NetBSD.org/src/rev/4775a2e794c2
branches: trunk
changeset: 784034:4775a2e794c2
user: matt <matt%NetBSD.org@localhost>
date: Tue Jan 15 16:52:35 2013 +0000
description:
Fix case when searching for NUL.
diffstat:
common/lib/libc/arch/arm/string/strchr_arm.S | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diffs (62 lines):
diff -r 28af58005cb4 -r 4775a2e794c2 common/lib/libc/arch/arm/string/strchr_arm.S
--- a/common/lib/libc/arch/arm/string/strchr_arm.S Tue Jan 15 13:52:26 2013 +0000
+++ b/common/lib/libc/arch/arm/string/strchr_arm.S Tue Jan 15 16:52:35 2013 +0000
@@ -29,7 +29,7 @@
#include <machine/asm.h>
-RCSID("$NetBSD: strchr_arm.S,v 1.1 2013/01/15 02:04:04 matt Exp $")
+RCSID("$NetBSD: strchr_arm.S,v 1.2 2013/01/15 16:52:35 matt Exp $")
#ifdef __ARMEL__
#define BYTE0 0x000000ff
@@ -92,8 +92,6 @@
*/
mvns ip, ip /* did we encounter a NUL? */
beq .Lfind_match /* no, find the match */
- eors r3, r3, ip /* remove NUL bit */
- beq .Lnomatch /* if no other bits, no match */
movs ip, ip, lshi #8 /* replicate NUL bit to other bytes */
orrne ip, ip, lshi #8 /* replicate NUL bit to other bytes */
orrne ip, ip, lshi #8 /* replicate NUL bit to other bytes */
@@ -128,27 +126,30 @@
sub r2, r0, #4 /* un post-inc */
mov r0, #0 /* assume no match */
- tst r3, #BYTE0 /* is this byte NUL? */
- RETc(eq) /* yes, return NULL */
+
tst ip, #BYTE0 /* does this byte match? */
moveq r0, r2 /* yes, point to it */
RETc(eq) /* and return */
+ tst r3, #BYTE0 /* is this byte NUL? */
+ RETc(eq) /* yes, return NULL */
+
+ tst ip, #BYTE1 /* does this byte match? */
+ addeq r0, r2, #1 /* yes, point to it */
+ RETc(eq) /* and return */
tst r3, #BYTE1 /* is this byte NUL? */
RETc(eq) /* yes, return NULL */
- tst ip, #BYTE1 /* does this byte match? */
- addeq r0, r2, #1 /* yes, point to it */
+
+ tst ip, #BYTE2 /* does this byte match? */
+ addeq r0, r2, #2 /* yes, point to it */
RETc(eq) /* and return */
tst r3, #BYTE2 /* is this byte NUL? */
RETc(eq) /* yes, return NULL */
- tst ip, #BYTE2 /* does this byte match? */
- addeq r0, r2, #2 /* yes, point to it */
- RETc(eq) /* and return */
- tst r3, #BYTE3 /* is this byte NUL? */
- RETc(eq) /* yes, return NULL */
+
+ tst ip, #BYTE3 /* does this byte match? */
+ addeq r0, r2, #3 /* yes, point to it */
/*
* Since no NULs and no matches this must be the only case left.
*/
- add r0, r2, #3 /* point to it */
RET /* return */
#endif /* _ARM_ARCH_6 */
END(strchr)
Home |
Main Index |
Thread Index |
Old Index