am 5dce6d19: am 5b81b918: libc: optimize memmove() with memcpy() if possible.

Merge commit '5dce6d195ac2c44614351f349e00ff5d8ebbe0bf'

* commit '5dce6d195ac2c44614351f349e00ff5d8ebbe0bf':
  libc: optimize memmove() with memcpy() if possible.
This commit is contained in:
David 'Digit' Turner 2010-10-10 11:26:53 -07:00 committed by Android Git Automerger
commit 0144b0b67c

View File

@ -31,7 +31,10 @@ 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 the optimized memcpy if the destination is below the
* source (i.e. q < p), or if it is completely over it (i.e. q >= p+n).
*/
if (__builtin_expect((q < p) || ((size_t)(q - p) >= n), 1)) {
return memcpy(dst, src, n);
} else {
#define PRELOAD_DISTANCE 64