blob: 9fb0efee4e4e24f11698e5137ae92f882d969cf5 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
2 * Copyright (C) 2002 Manuel Novoa III
3 * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
4 *
5 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 */
7
8#include "_string.h"
9
10#ifdef WANT_WIDE
11# define Wmemmove wmemmove
12#else
13# define Wmemmove memmove
14#endif
15
16Wvoid *Wmemmove(Wvoid *s1, const Wvoid *s2, size_t n)
17{
18 register Wchar *s = (Wchar *) s1;
19 register const Wchar *p = (const Wchar *) s2;
20
21 if (p >= s) {
22 while (n) {
23 *s++ = *p++;
24 --n;
25 }
26 } else {
27 while (n) {
28 --n;
29 s[n] = p[n];
30 }
31 }
32
33 return s1;
34}
35
36#ifndef WANT_WIDE
37libc_hidden_def(Wmemmove)
38#endif