Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
9765 turbocat 1
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
#include 
3
 
4
char* strncpy(char* dst, const char* src, size_t n)
5
{
6
    int d0, d1, d2, d3;
7
    __asm__ __volatile__(
8
        "1:\tdecl %2\n\t"
9
        "js 2f\n\t"
10
        "lodsb\n\t"
11
        "stosb\n\t"
12
        "testb %%al,%%al\n\t"
13
        "jne 1b\n\t"
14
        "rep\n\t"
15
        "stosb\n"
16
        "2:"
17
        : "=&S"(d0), "=&D"(d1), "=&c"(d2), "=&a"(d3)
18
        : "0"(src), "1"(dst), "2"(n)
19
        : "memory");
20
    return dst;
8687 turbocat 21
}