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 / memcmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-20  |  454 b   |  30 lines

  1. #include <string.h>
  2.  
  3. #ifdef isbcmp
  4. #define    memcmp    bcmp
  5. #define size_t    int
  6. #endif
  7.  
  8. #include "asm-ops.h"
  9.  
  10. int
  11. memcmp(const void * cs,const void * ct,size_t count)
  12. {
  13.   register int __res;
  14.  
  15. #ifdef isbcmp
  16.   if (count <= 0) return 0;
  17. #endif
  18.  
  19.   __asm__ __volatile__ ("cld\n\t"
  20.     "repe\n\t"
  21.     "cmpsb\n\t"
  22.     "je " LF(1) "\n\t"
  23.     "sbbl %%eax,%%eax\n\t"
  24.     "orb $1,%%al\n"
  25.     LL(1) 
  26.     :"=a" (__res):"0" (0),"S" (cs),"D" (ct),"c" (count)
  27.     :"si","di","cx");
  28.   return __res;
  29. }
  30.