summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/config/memmove.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/config/memmove.c')
-rw-r--r--contrib/gcc/config/memmove.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/gcc/config/memmove.c b/contrib/gcc/config/memmove.c
new file mode 100644
index 0000000..13b340a
--- /dev/null
+++ b/contrib/gcc/config/memmove.c
@@ -0,0 +1,20 @@
+/* Public domain. */
+#include <stddef.h>
+
+void *
+memmove (void *dest, const void *src, size_t len)
+{
+ char *d = dest;
+ const char *s = src;
+ if (d < s)
+ while (len--)
+ *d++ = *s++;
+ else
+ {
+ char *lasts = s + (len-1);
+ char *lastd = d + (len-1);
+ while (len--)
+ *lastd-- = *lasts--;
+ }
+ return dest;
+}
OpenPOWER on IntegriCloud