--- ed16688385846cde748b806c38038910b2300dfb +++ 01fad9b203e192eb8a3299d669c29e11e4cf2e04 @@ -23,7 +23,6 @@ #include #include #include -#include #ifndef __HAVE_ARCH_STRNICMP /** @@ -597,11 +596,11 @@ EXPORT_SYMBOL(memset); */ void *memcpy(void *dest, const void *src, size_t count) { - unsigned long dstp = (unsigned long)dest; - unsigned long srcp = (unsigned long)src; + char *tmp = dest; + const char *s = src; - /* Copy from the beginning to the end */ - mem_copy_fwd(dstp, srcp, count); + while (count--) + *tmp++ = *s++; return dest; } EXPORT_SYMBOL(memcpy); @@ -618,15 +617,21 @@ EXPORT_SYMBOL(memcpy); */ void *memmove(void *dest, const void *src, size_t count) { - unsigned long dstp = (unsigned long)dest; - unsigned long srcp = (unsigned long)src; + char *tmp; + const char *s; - if (dest - src >= count) { - /* Copy from the beginning to the end */ - mem_copy_fwd(dstp, srcp, count); + if (dest <= src) { + tmp = dest; + s = src; + while (count--) + *tmp++ = *s++; } else { - /* Copy from the end to the beginning */ - mem_copy_bwd(dstp, srcp, count); + tmp = dest; + tmp += count; + s = src; + s += count; + while (count--) + *--tmp = *--s; } return dest; }