summaryrefslogtreecommitdiff
path: root/libc/string/i386/strncmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string/i386/strncmp.c')
-rw-r--r--libc/string/i386/strncmp.c41
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)