mescc: Mes C Library: Prepare for M2-Planet: memcpy.

* lib/string/memcpy.c: Rewrite C-constructs not supported by M2-Planet.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-05-17 19:29:36 +02:00
parent b20a388715
commit 3b68e7de64
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -21,12 +21,24 @@
#include <mes/lib.h>
#include <string.h>
char *
_memcpy (char *dest, char const *src, size_t n)
{
char *p = dest;
while (n != 0)
{
n = n - 1;
dest[0] = src[0];
dest = dest + 1;
src = src + 1;
}
return p;
}
void *
memcpy (void *dest, void const *src, size_t n)
{
char *p = dest;
char const *q = src;
while (n--)
*p++ = *q++;
return dest;
return _memcpy (dest, src, n);
}