ref: ef8d13b810f3c48c78b6d3ef121872becee05d28
parent: 07094f38b49ec4f867ea7cd8f5d453940e48951c
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Feb 16 17:48:02 EST 2017
[libc] Add memcpy()
--- 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
--- /dev/null
+++ b/libc/src/memcpy.c
@@ -1,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;
+}