From ec3c031b2f16d92d20937bb6c374092b0ebd0620 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 30 Jul 2017 13:59:06 +0200 Subject: [PATCH] mescc: Tinycc support: memmove. * mlibc/libc-mes+tcc.c (memmove): Implement. --- mlibc/libc-mes+tcc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mlibc/libc-mes+tcc.c b/mlibc/libc-mes+tcc.c index b704302c..1be83122 100644 --- a/mlibc/libc-mes+tcc.c +++ b/mlibc/libc-mes+tcc.c @@ -194,8 +194,13 @@ memcpy (void *dest, void const *src, size_t n) void * memmove (void *dest, void const *src, size_t n) { - eputs ("memmove stub\n"); - return 0; + if (dest < src) + return memcpy (dest, src, n); + char *p = dest + n; + char const *q = src +n; + while (n--) + *--p = *--q; + return dest; } void *