You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
336 B
26 lines
336 B
void *memcpy(void *s1, const void *s2, size_t n)
|
|
{
|
|
const char *f = s2;
|
|
char *t = s1;
|
|
|
|
if (f < t) {
|
|
f += n;
|
|
t += n;
|
|
while (n-- > 0)
|
|
*--t = *--f;
|
|
} else
|
|
while (n-- > 0)
|
|
*t++ = *f++;
|
|
return s1;
|
|
}
|
|
|
|
static void * memset(void * s,int c, size_t count)
|
|
{
|
|
char *xs = (char *) s;
|
|
|
|
while (count--)
|
|
*xs++ = c;
|
|
|
|
return s;
|
|
}
|
|
|
|
|