diff --git a/app/lib/charbuf.cpp b/app/lib/charbuf.cpp index 9fb0a220..ea3a1122 100644 --- a/app/lib/charbuf.cpp +++ b/app/lib/charbuf.cpp @@ -128,7 +128,7 @@ void CharBuffer::EnsureSize(unsigned int size) cursize = cursize < tempsize * 2 ? tempsize * 2 : cursize; unsigned int offset = (unsigned int)(ptr - buf); char *temp = new char[cursize]; - MemCopy(temp, buf, tempsize); + MemCopyQuick(temp, buf, tempsize); delete [] buf; buf = temp; ptr = buf + offset; @@ -146,7 +146,7 @@ void CharBuffer::EnsureSize(unsigned int blocksize, unsigned int blocks) } else { unsigned int tptr = (unsigned int)(ptr - buf); char *temp = new char[blocksize * blocks]; - MemCopy(temp, buf, cursize); + MemCopyQuick(temp, buf, cursize); delete [] buf; cursize = blocksize * blocks; buf = temp; @@ -270,4 +270,3 @@ char* CharBuffer::GetString() *ptr = '\0'; return buf; } - diff --git a/lib/clib/alloccpy.c b/lib/clib/alloccpy.c index d60c01bb..62babefa 100644 --- a/lib/clib/alloccpy.c +++ b/lib/clib/alloccpy.c @@ -51,8 +51,12 @@ unsigned int AllocAndCopy(char **destination, const char *source) *destination = AllocMemSafe(size); d = *destination; +#ifdef AMIGA // Take advantage of exec + CopyMem(s, d, n); +#else while (n--) *d++ = *s++; +#endif return size; } diff --git a/lib/clib/memcpy.c b/lib/clib/memcpy.c index b8d2ec57..298e180c 100644 --- a/lib/clib/memcpy.c +++ b/lib/clib/memcpy.c @@ -81,6 +81,9 @@ void MemCopy(void *destination, const void *source, unsigned int length) if ((mem_ptr)dst < (mem_ptr)src) { // Copy forward +#ifdef AMIGA // Take advantage of exec + CopyMem((void*)source, destination, length); +#else t = (mem_ptr)src; // only need low bits if ((t | (mem_ptr)dst) & wmask) { @@ -100,7 +103,7 @@ void MemCopy(void *destination, const void *source, unsigned int length) t = length & wmask; TLOOP(*dst++ = *src++); - +#endif } else { // Copy backwards. Otherwise essentially the same. // Alignment works as before, except that it takes diff --git a/lib/platform.h b/lib/platform.h index ea2b851b..604604ee 100644 --- a/lib/platform.h +++ b/lib/platform.h @@ -157,6 +157,12 @@ typedef u_int32_t uint32_t; typedef u_int64_t uint64_t; #endif +#ifdef AMIGA // Take advantage of exec +# define MemCopyQuick(d,s,l) CopyMemQuick((void*)(s),d,l); +#else +# define MemCopyQuick(d,s,l) MemCopy(d,s,l); +#endif + /* Compilers*/ #if defined(__clang__) /* Clang */