summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/nios2/shared/misc/memcpy.c
blob: ceae3c6548a94268d67d5dc61a20c799077a062f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 *  C library memcpy routine
 *
 *  This routine shall get code to optimize performance on NIOS II
 *
 *  The routine is placed in this source directory to ensure that it
 *  is picked up by all applications.
 */

#include <string.h>

void *
memcpy(void *s1, const void *s2, size_t n)
{
	char *p1 = s1;
	const char *p2 = s2;
    size_t left = n;

    while(left > 0) *(p1++) = *(p2++);
	return s1;
}