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 / strcmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-13  |  385 b   |  22 lines

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