Commit f0219373 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Copy memmove implementation from ntdll.

parent 773f0a83
...@@ -2230,19 +2230,32 @@ int __cdecl MSVCRT_memcmp(const void *ptr1, const void *ptr2, MSVCRT_size_t n) ...@@ -2230,19 +2230,32 @@ int __cdecl MSVCRT_memcmp(const void *ptr1, const void *ptr2, MSVCRT_size_t n)
} }
/********************************************************************* /*********************************************************************
* memcpy (MSVCRT.@) * memmove (MSVCRT.@)
*/ */
void * __cdecl MSVCRT_memcpy(void *dst, const void *src, MSVCRT_size_t n) void * __cdecl MSVCRT_memmove(void *dst, const void *src, MSVCRT_size_t n)
{ {
return memmove(dst, src, n); volatile unsigned char *d = dst; /* avoid gcc optimizations */
const unsigned char *s = src;
if ((MSVCRT_size_t)dst - (MSVCRT_size_t)src >= n)
{
while (n--) *d++ = *s++;
}
else
{
d += n - 1;
s += n - 1;
while (n--) *d-- = *s--;
}
return dst;
} }
/********************************************************************* /*********************************************************************
* memmove (MSVCRT.@) * memcpy (MSVCRT.@)
*/ */
void * __cdecl MSVCRT_memmove(void *dst, const void *src, MSVCRT_size_t n) void * __cdecl MSVCRT_memcpy(void *dst, const void *src, MSVCRT_size_t n)
{ {
return memmove(dst, src, n); return MSVCRT_memmove(dst, src, n);
} }
/********************************************************************* /*********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment