diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-23 10:46:57 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-23 10:46:57 +0000 |
commit | 1e0c4ca7448cf41bd38742ae885c9da6f4e48d97 (patch) | |
tree | 3908c0720db2470fefbc4c0824401dbf45862f83 /libc/string/i386/strncmp.c | |
parent | 7bca85d261904a0a67f2e514b6c4972128561156 (diff) | |
download | uClibc-alpine-1e0c4ca7448cf41bd38742ae885c9da6f4e48d97.tar.bz2 uClibc-alpine-1e0c4ca7448cf41bd38742ae885c9da6f4e48d97.tar.xz |
sync with trunk. Compile tested on i386
Diffstat (limited to 'libc/string/i386/strncmp.c')
-rw-r--r-- | libc/string/i386/strncmp.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/libc/string/i386/strncmp.c b/libc/string/i386/strncmp.c index a14bb503b..bfb20c307 100644 --- a/libc/string/i386/strncmp.c +++ b/libc/string/i386/strncmp.c @@ -32,27 +32,28 @@ #include <string.h> -/* Experimentally off - libc_hidden_proto(strncmp) */ +#undef strncmp int strncmp(const char *cs, const char *ct, size_t count) { - register int __res; - int d0, d1, d2; - __asm__ __volatile__( - "incl %3\n" - "1:\tdecl %3\n\t" - "jz 2f\n" - "lodsb\n\t" - "scasb\n\t" - "jne 3f\n\t" - "testb %%al,%%al\n\t" - "jne 1b\n" - "2:\txorl %%eax,%%eax\n\t" - "jmp 4f\n" - "3:\tsbbl %%eax,%%eax\n\t" - "orb $1,%%al\n" - "4:" - :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) - :"1" (cs),"2" (ct),"3" (count)); - return __res; + int eax; + int esi, edi, ecx; + __asm__ __volatile__( + " incl %%ecx\n" + "1: decl %%ecx\n" + " jz 2f\n" + " lodsb\n" + " scasb\n" + " jne 3f\n" + " testb %%al, %%al\n" + " jnz 1b\n" + "2: xorl %%eax, %%eax\n" + " jmp 4f\n" + "3: sbbl %%eax, %%eax\n" + " orb $1, %%al\n" + "4:\n" + : "=a" (eax), "=&S" (esi), "=&D" (edi), "=&c" (ecx) + : "1" (cs), "2" (ct), "3" (count) + ); + return eax; } libc_hidden_weak(strncmp) |