libc: memmove(): non-overlapping block optim.
Change-Id: I5652f4f97ca59d95176443fc27c737ef76258183
This commit is contained in:
parent
b9e49ad56e
commit
80fba9a2fe
@ -31,7 +31,11 @@ void *memmove(void *dst, const void *src, size_t n)
|
||||
{
|
||||
const char *p = src;
|
||||
char *q = dst;
|
||||
if (__builtin_expect(q < p, 1)) {
|
||||
|
||||
/* we can use highgly-optimized memcpy() if the destination
|
||||
* is before the source, or if the two blocks are non-overlapping
|
||||
*/
|
||||
if (__builtin_expect((q < p || (q-p) <= (ptrdiff_t)n), 1)) {
|
||||
return memcpy(dst, src, n);
|
||||
} else {
|
||||
#define PRELOAD_DISTANCE 64
|
||||
|
Loading…
Reference in New Issue
Block a user