[uClibc-cvs] uClibc/libc/string/arm strlen.S,1.1,1.2
Erik Andersen,,,
andersen at uclibc.org
Sat Jun 12 06:12:24 UTC 2004
Update of /var/cvs/uClibc/libc/string/arm
In directory nail:/tmp/cvs-serv30774
Modified Files:
strlen.S
Log Message:
Philip Craig at snapgear dot com writes:
Strlen was counting the last 3 bytes incorrectly for big endian arm.
Index: strlen.S
===================================================================
RCS file: /var/cvs/uClibc/libc/string/arm/strlen.S,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- a/strlen.S 20 Nov 2003 15:23:03 -0000 1.1
+++ b/strlen.S 12 Jun 2004 06:12:21 -0000 1.2
@@ -59,12 +59,21 @@
ldrne r2, [r1], $4 @ and we continue to the next word
bne Laligned @
Llastword: @ drop through to here once we find a
- tst r2, $0x000000ff @ word that has a zero byte in it
+#if __BYTE_ORDER == __BIG_ENDIAN
+ tst r2, $0xff000000 @ word that has a zero byte in it
+ addne r0, r0, $1 @
+ tstne r2, $0x00ff0000 @ and add up to 3 bytes on to it
+ addne r0, r0, $1 @
+ tstne r2, $0x0000ff00 @ (if first three all non-zero, 4th
+ addne r0, r0, $1 @ must be zero)
+#else
+ tst r2, $0x000000ff @
addne r0, r0, $1 @
tstne r2, $0x0000ff00 @ and add up to 3 bytes on to it
addne r0, r0, $1 @
tstne r2, $0x00ff0000 @ (if first three all non-zero, 4th
addne r0, r0, $1 @ must be zero)
+#endif
mov pc,lr
.size strlen,.-strlen;
More information about the uClibc-cvs
mailing list