Numworks Epsilon  1.4.1
Graphing Calculator Operating System
memmove.c
Go to the documentation of this file.
1 #include <string.h>
2 
3 void * memmove(void * dst, const void * src, size_t n) {
4  char * destination = (char *)dst;
5  char * source = (char *)src;
6 
7  if (source < destination && destination < source + n) {
8  /* Copy backwards to avoid overwrites */
9  source += n;
10  destination += n;
11  while (n--) {
12  *--destination = *--source;
13  }
14  } else {
15  while (n--) {
16  *destination++ = *source++;
17  }
18  }
19 
20  return dst;
21 }
void * memmove(void *dst, const void *src, size_t n)
Definition: memmove.c:3