summaryrefslogtreecommitdiff
path: root/libc/string/generic
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@rt-rk.com>2019-05-06 13:29:02 +0000
committerWaldemar Brodkorb <wbx@openadk.org>2019-05-27 14:54:52 +0200
commit785dee78552f9ad06819bf7eb1adc05b43110842 (patch)
tree7df9f5859683ddb93c47350bd1b92cc0037b5614 /libc/string/generic
parentc2eaf6c30d930b65a8bcf5f912ef8873a6f4eb20 (diff)
mips: fix memmove() call when __ARCH_HAS_BWD_MEMCPY__ is not defined
When arch (such as MIPS) does not define __ARCH_HAS_BWD_MEMCPY__, memmove() calls memcpy() which is wrong for overlapping regions. Signed-off-by: Petar Jovanovic <petar.jovanovic@rt-rk.com>
Diffstat (limited to 'libc/string/generic')
-rw-r--r--libc/string/generic/memmove.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c
index bf78c4778..1ac018013 100644
--- a/libc/string/generic/memmove.c
+++ b/libc/string/generic/memmove.c
@@ -23,7 +23,7 @@
#include "memcopy.h"
#include "pagecopy.h"
-#ifdef __ARCH_HAS_BWD_MEMCPY__
+#ifndef __ARCH_HAS_BWD_MEMCPY__
/* generic-opt memmove assumes memcpy does forward copying! */
#include "_memcpy_fwd.c"
#endif
@@ -224,8 +224,8 @@ void *memmove (void *dest, const void *src, size_t len)
Reduces the working set. */
if (dstp - srcp >= len) /* *Unsigned* compare! */
{
-#ifndef __ARCH_HAS_BWD_MEMCPY__
- /* Backward memcpy implementation cannot be used */
+#ifdef __ARCH_HAS_BWD_MEMCPY__
+ /* Backward memcpy implementation can be used */
memcpy(dest, src, len);
#else
/* Copy from the beginning to the end. */