summaryrefslogtreecommitdiffstats
path: root/libc/string/i386/strlen.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-23 10:46:57 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-23 10:46:57 +0000
commit1e0c4ca7448cf41bd38742ae885c9da6f4e48d97 (patch)
tree3908c0720db2470fefbc4c0824401dbf45862f83 /libc/string/i386/strlen.c
parent7bca85d261904a0a67f2e514b6c4972128561156 (diff)
downloaduClibc-alpine-1e0c4ca7448cf41bd38742ae885c9da6f4e48d97.tar.bz2
uClibc-alpine-1e0c4ca7448cf41bd38742ae885c9da6f4e48d97.tar.xz
sync with trunk. Compile tested on i386
Diffstat (limited to 'libc/string/i386/strlen.c')
-rw-r--r--libc/string/i386/strlen.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libc/string/i386/strlen.c b/libc/string/i386/strlen.c
index 61a178393..ff2baeb38 100644
--- a/libc/string/i386/strlen.c
+++ b/libc/string/i386/strlen.c
@@ -32,17 +32,17 @@
#include <string.h>
-/* Experimentally off - libc_hidden_proto(strlen) */
+#undef strlen
size_t strlen(const char *s)
{
- int d0;
- register int __res;
- __asm__ __volatile__(
- "repne\n\t"
- "scasb\n\t"
- "notl %0\n\t"
- "decl %0"
- :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffff));
- return __res;
+ int eax, ecx, edi;
+ __asm__ __volatile__(
+ " repne; scasb\n"
+ " notl %%ecx\n"
+ " leal -1(%%ecx), %%eax\n"
+ : "=&c" (ecx), "=&D" (edi), "=&a" (eax)
+ : "0" (0xffffffff), "1" (s), "2" (0)
+ );
+ return eax;
}
libc_hidden_def(strlen)