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

  1. #include <string.h>
  2.  
  3. #include "asm-ops.h"
  4.  
  5. size_t strcspn(const char * cs, const char * ct)
  6. {
  7. register char * __res;
  8. __asm__ __volatile__ ("cld\n\t"
  9.     "movl %4,%%edi\n\t"
  10.     "repne\n\t"
  11.     "scasb\n\t"
  12.     "notl %%ecx\n\t"
  13.     "decl %%ecx\n\t"
  14.     "movl %%ecx,%%edx\n"
  15.     LL(1) "\tlodsb\n\t"
  16.     "testb %%al,%%al\n\t"
  17.     "je " LF(2) "\n\t"
  18.     "movl %4,%%edi\n\t"
  19.     "movl %%edx,%%ecx\n\t"
  20.     "repne\n\t"
  21.     "scasb\n\t"
  22.     "jne " LB(1) "\n"
  23.     LL(2) "\tdecl %0"
  24.     :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
  25.     :"ax","cx","dx","di");
  26. return (size_t) (__res-cs);
  27. }
  28.