voron

experimental ARM OS
git clone git://git.2f30.org/voron.git
Log | Files | Refs | LICENSE

commit 73395a92ba65e1bffb4589714336a59b8a544573
parent 95d4017b221dc21551848fffb460f277eb4a5fe8
Author: sin <sin@2f30.org>
Date:   Sun Jul 21 20:54:19 +0100

Add memmove()

Diffstat:
include/string.h | 1+
kernel/string.c | 22++++++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/include/string.h b/include/string.h @@ -5,6 +5,7 @@ void *memset(void *s, int c, size_t n); void *memcpy(void *s1, const void *s2, size_t n); +void *memmove(void *dest, const void *src, size_t count); int memcmp(const void *s1, const void *s2, size_t n); #endif /* __STRING_H */ diff --git a/kernel/string.c b/kernel/string.c @@ -31,6 +31,28 @@ memcpy(void *s1, const void *s2, size_t n) return s1; } +void * +memmove(void *dest, const void *src, size_t count) +{ + char *tmp; + const char *s; + + if (dest <= src) { + tmp = dest; + s = src; + while (count--) + *tmp++ = *s++; + } else { + tmp = dest; + tmp += count; + s = src; + s += count; + while (count--) + *--tmp = *--s; + } + return dest; +} + int memcmp(const void *s1, const void *s2, size_t n) {