Take advantage of exec

This commit is contained in:
Carsten Larsen 2017-02-10 22:29:49 +01:00
parent 88e0a919f6
commit 200d0e5959
4 changed files with 16 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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 */