OSDN Git Service

hidden_def/hidden_proto: convert all users (I hope) termios split, add some missing...
[uclinux-h8/uClibc.git] / libc / string / memmove.c
1 /*
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 libc_hidden_proto(memmove)
14 # define Wmemmove memmove
15 #endif
16
17 Wvoid *Wmemmove(Wvoid *s1, const Wvoid *s2, size_t n)
18 {
19 #ifdef __BCC__
20         register Wchar *s = (Wchar *) s1;
21         register const Wchar *p = (const Wchar *) s2;
22
23         if (p >= s) {
24                 while (n--) {
25                         *s++ = *p++;
26                 }
27         } else {
28                 s += n;
29                 p += n;
30                 while (n--) {
31                         *--s = *--p;
32                 }
33         }
34
35         return s1;
36 #else
37         register Wchar *s = (Wchar *) s1;
38         register const Wchar *p = (const Wchar *) s2;
39
40         if (p >= s) {
41                 while (n) {
42                         *s++ = *p++;
43                         --n;
44                 }
45         } else {
46                 while (n) {
47                         --n;
48                         s[n] = p[n];
49                 }
50         }
51
52         return s1;
53 #endif
54 }
55
56 #ifndef WANT_WIDE
57 libc_hidden_def(Wmemmove)
58 #endif