POK(kernelpart)
memcpy.c File Reference
#include <libc.h>

Go to the source code of this file.

Functions

void * memcpy (void *to, const void *from, size_t n)

Function Documentation

void* memcpy ( void *  to,
const void *  from,
size_t  n 
)

Definition at line 20 of file memcpy.c.

{
#ifdef __i386__
int d0;
int d1;
int d2;
__asm__ __volatile__(
"rep ; movsl\n\t"
"testb $2,%b4\n\t"
"je 1f\n\t"
"movsw\n"
"1:\ttestb $1,%b4\n\t"
"je 2f\n\t"
"movsb\n"
"2:"
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
:"0" (n/4), "q" (n),"1" ((long) to),"2" ((long) from)
: "memory");
#else
char *cto = (char *)to;
const char *cfrom = (const char *)from;
for (; n > 0; n--)
{
*cto++ = *cfrom++;
}
#endif
return (to);
}