1 /*-------------------------------------------------------------------------
2 _memmove.c - part of string library functions
4 Adapted By - Erik Petrich . epetrich@users.sourceforge.net
5 from _memcpy.c which was originally
6 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999)
8 This library is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Library General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 In other words, you are welcome to use, share and improve this program.
23 You are forbidden to forbid anyone else to use, share and improve
24 what you give them. Help stamp out software-hoarding!
25 -------------------------------------------------------------------------*/
29 #ifndef _SDCC_PORT_PROVIDES_MEMMOVE
30 #define _SDCC_PORT_PROVIDES_MEMMOVE 0
33 #if !_SDCC_PORT_PROVIDES_MEMMOVE
41 #if _SDCC_Z80_STYLE_LIB_OPT
47 /* PENDING: Divide first to get around sign problems */
48 int count = -(acount >> 2);
50 if (((int)src < (int)dst) && ((((int)src)+acount) > (int)dst)) {
52 * copy from higher addresses to lower addresses
54 d = ((char *)dst)+acount-1;
55 s = ((char *)src)+acount-1;
74 * copy from lower addresses to higher addresses
100 if (((int)src < (int)dst) && ((((int)src)+acount) > (int)dst)) {
102 * copy from higher addresses to lower addresses
104 d = ((char *)dst)+acount-1;
105 s = ((char *)src)+acount-1;
112 * copy from lower addresses to higher addresses