Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include <string.h>
  2.  
  3. char *
  4. strncat(char *dst, const char *src, size_t n)
  5. {
  6. int d0, d1, d2, d3;
  7. __asm__ __volatile__(
  8.         "repne\n\t"
  9.         "scasb\n\t"
  10.         "decl %1\n\t"
  11.         "movl %8,%3\n"
  12.         "1:\tdecl %3\n\t"
  13.         "js 2f\n\t"
  14.         "lodsb\n\t"
  15.         "stosb\n\t"
  16.         "testb %%al,%%al\n\t"
  17.         "jne 1b\n"
  18.         "2:\txorl %2,%2\n\t"
  19.         "stosb"
  20.         : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
  21.         : "0" (src),"1" (dst),"2" (0),"3" (0xffffffff), "g" (n)
  22.         : "memory");
  23. return dst;
  24. }
  25.