scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 673610fb8b9defeab63b90549251dfc885fa152d
parent f8fd3858424b64391e582fc7e53f8a63ee113d98
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 16 Feb 2017 22:48:02 +0100

[libc] Add memcpy()

Diffstat:
Mlibc/src/Makefile | 2+-
Alibc/src/memcpy.c | 13+++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/libc/src/Makefile b/libc/src/Makefile @@ -3,7 +3,7 @@ LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \ strrchr.o strcat.o strncpy.o strncat.o \ - memset.o + memset.o memcpy.o all: libc.a diff --git a/libc/src/memcpy.c b/libc/src/memcpy.c @@ -0,0 +1,13 @@ +/* See LICENSE file for copyright and license details. */ + +#include <string.h> + +void * +memcpy(void *dst, const void *src, size_t n) +{ + char *s1 = dst, *s2 = (char *) src; + + while (n-- > 0) + *s1++ = *s2++; + return dst; +}