#include "SDL_internal.h"
#ifdef SDL_memmove
#undef SDL_memmove
#endif
#if SDL_DYNAMIC_API
#define SDL_memmove SDL_memmove_REAL
#endif
void *SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
{
#if defined(__GNUC__) && (defined(HAVE_LIBC) && HAVE_LIBC)
return __builtin_memmove(dst, src, len);
#elif defined(HAVE_MEMMOVE)
return memmove(dst, src, len);
#else
char *srcp = (char *)src;
char *dstp = (char *)dst;
if (src < dst) {
srcp += len - 1;
dstp += len - 1;
while (len--) {
*dstp-- = *srcp--;
}
} else {
while (len--) {
*dstp++ = *srcp++;
}
}
return dst;
#endif }
#ifndef HAVE_LIBC
extern void *memmove(void *dst, const void *src, size_t len);
#if defined(_MSC_VER) && !defined(__INTEL_LLVM_COMPILER)
#pragma intrinsic(memmove)
#endif
#if defined(_MSC_VER) && !defined(__clang__)
#pragma function(memmove)
#endif
void *memmove(void *dst, const void *src, size_t len)
{
return SDL_memmove(dst, src, len);
}
#endif