Subversion Repositories Kolibri OS

Rev

Rev 8793 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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