home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / sysdeps / i386 / strncmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-12  |  472 b   |  25 lines

  1. #include <string.h>
  2.  
  3. #include "asm-ops.h"
  4.  
  5. int strncmp(const char * cs,const char * ct,size_t count)
  6. {
  7. register int __res;
  8. __asm__("cld\n\t"
  9.     "incl %3\n"
  10.     LL(1) "\tdecl %3\n\t"
  11.     "je " LF(2) "\n\t"
  12.     "lodsb\n\t"
  13.     "scasb\n\t"
  14.     "jne " LF(3) "\n\t"
  15.     "testb %%al,%%al\n\t"
  16.     "jne " LB(1) "\n"
  17.     LL(2) "\txorl %%eax,%%eax\n\t"
  18.     "jmp " LF(4) "\n"
  19.     LL(3) "\tsbbl %%eax,%%eax\n\t"
  20.     "orb $1,%%al\n"
  21.     LL(4) 
  22.     :"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx");
  23. return __res;
  24. }
  25.