~mingw-w64/mingw-w64/experimental

« back to all changes in this revision

Viewing changes to libw64crt/string/memmove.c

  • Committer: ktietz70
  • Date: 2009-12-07 19:49:25 UTC
  • Revision ID: svn-v4:4407c894-4637-0410-b4f5-ada5f102cad1:experimental:1611
Rename to iCrt (ironCrate)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <w64crt.h>
2
 
#include <w64string.h>
3
 
 
4
 
void *
5
 
memmove (void *d, const void *s, size_t n)
6
 
{
7
 
  char *dc = (char *) d;
8
 
  const char *sc = (const char *) s;
9
 
  if (dc == sc || (dc < sc && (dc + n) <= sc))
10
 
    return memcpy (d, s, n);
11
 
  else if (dc > sc && (sc + n) <= dc)
12
 
    return memcpy (d, s, n);
13
 
  sc += n;
14
 
  dc += n;
15
 
  while (n > 0)
16
 
   {
17
 
     --sc, --dc;
18
 
     *dc = *sc;
19
 
     --n;
20
 
   }
21
 
  return d;
22
 
}
23