* as/z80/z80mch.c: fixed bug #1704376: missing as-z80 errors
[fw/sdcc] / device / lib / _memcpy.c
index d5ddf9e7a3faafe51e44b480a1e0d3225931675d..540c2cf296e9f6ff51b84b5ea3de2dc4c65aaa8c 100644 (file)
 
 #if !_SDCC_PORT_PROVIDES_MEMCPY
 
-#define NULL (void *)0
+#undef memcpy /* Avoid conflict with builtin memcpy() in Z80 port */
 
 void * memcpy (
        void * dst,
        void * src,
-       int acount
+       size_t acount
        ) 
 {
 #if _SDCC_Z80_STYLE_LIB_OPT
 
-#pragma NOINDUCTION
+#pragma noinduction
 
        char * d = dst;
        char * s = src;
-       int count = -acount;
+       /* PENDING: Divide first to get around sign problems */
+       int count = -(acount >> 2);
 
-        count /= 4;
-        
         while (count) {
                *d++ = *s++;
                *d++ = *s++;