wmemmove.c raw

   1  #include <wchar.h>
   2  #include <stdint.h>
   3  
   4  wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n)
   5  {
   6  	wchar_t *d0 = d;
   7  	if (d == s) return d;
   8  	if ((uintptr_t)d-(uintptr_t)s < n * sizeof *d)
   9  		while (n--) d[n] = s[n];
  10  	else
  11  		while (n--) *d++ = *s++;
  12  	return d0;
  13  }
  14