mirror of https://gitlab.com/rnger/amath
Take advantage of exec
This commit is contained in:
parent
88e0a919f6
commit
200d0e5959
|
@ -128,7 +128,7 @@ void CharBuffer::EnsureSize(unsigned int size)
|
||||||
cursize = cursize < tempsize * 2 ? tempsize * 2 : cursize;
|
cursize = cursize < tempsize * 2 ? tempsize * 2 : cursize;
|
||||||
unsigned int offset = (unsigned int)(ptr - buf);
|
unsigned int offset = (unsigned int)(ptr - buf);
|
||||||
char *temp = new char[cursize];
|
char *temp = new char[cursize];
|
||||||
MemCopy(temp, buf, tempsize);
|
MemCopyQuick(temp, buf, tempsize);
|
||||||
delete [] buf;
|
delete [] buf;
|
||||||
buf = temp;
|
buf = temp;
|
||||||
ptr = buf + offset;
|
ptr = buf + offset;
|
||||||
|
@ -146,7 +146,7 @@ void CharBuffer::EnsureSize(unsigned int blocksize, unsigned int blocks)
|
||||||
} else {
|
} else {
|
||||||
unsigned int tptr = (unsigned int)(ptr - buf);
|
unsigned int tptr = (unsigned int)(ptr - buf);
|
||||||
char *temp = new char[blocksize * blocks];
|
char *temp = new char[blocksize * blocks];
|
||||||
MemCopy(temp, buf, cursize);
|
MemCopyQuick(temp, buf, cursize);
|
||||||
delete [] buf;
|
delete [] buf;
|
||||||
cursize = blocksize * blocks;
|
cursize = blocksize * blocks;
|
||||||
buf = temp;
|
buf = temp;
|
||||||
|
@ -270,4 +270,3 @@ char* CharBuffer::GetString()
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,12 @@ unsigned int AllocAndCopy(char **destination, const char *source)
|
||||||
*destination = AllocMemSafe(size);
|
*destination = AllocMemSafe(size);
|
||||||
d = *destination;
|
d = *destination;
|
||||||
|
|
||||||
|
#ifdef AMIGA // Take advantage of exec
|
||||||
|
CopyMem(s, d, n);
|
||||||
|
#else
|
||||||
while (n--)
|
while (n--)
|
||||||
*d++ = *s++;
|
*d++ = *s++;
|
||||||
|
#endif
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,9 @@ void MemCopy(void *destination, const void *source, unsigned int length)
|
||||||
|
|
||||||
if ((mem_ptr)dst < (mem_ptr)src) {
|
if ((mem_ptr)dst < (mem_ptr)src) {
|
||||||
// Copy forward
|
// Copy forward
|
||||||
|
#ifdef AMIGA // Take advantage of exec
|
||||||
|
CopyMem((void*)source, destination, length);
|
||||||
|
#else
|
||||||
t = (mem_ptr)src; // only need low bits
|
t = (mem_ptr)src; // only need low bits
|
||||||
if ((t | (mem_ptr)dst) & wmask) {
|
if ((t | (mem_ptr)dst) & wmask) {
|
||||||
|
|
||||||
|
@ -100,7 +103,7 @@ void MemCopy(void *destination, const void *source, unsigned int length)
|
||||||
|
|
||||||
t = length & wmask;
|
t = length & wmask;
|
||||||
TLOOP(*dst++ = *src++);
|
TLOOP(*dst++ = *src++);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Copy backwards. Otherwise essentially the same.
|
// Copy backwards. Otherwise essentially the same.
|
||||||
// Alignment works as before, except that it takes
|
// Alignment works as before, except that it takes
|
||||||
|
|
|
@ -157,6 +157,12 @@ typedef u_int32_t uint32_t;
|
||||||
typedef u_int64_t uint64_t;
|
typedef u_int64_t uint64_t;
|
||||||
#endif
|
#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*/
|
/* Compilers*/
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
/* Clang */
|
/* Clang */
|
||||||
|
|
Loading…
Reference in New Issue