Fixed linking x64 with Visual Studio 2010.

This commit is contained in:
Sam Lantinga 2011-03-08 22:48:21 -08:00
parent 57a49884db
commit 5f55b90cbd
3 changed files with 41 additions and 3 deletions

39
src/stdlib/SDL_stdlib.c Normal file → Executable file
View file

@ -35,6 +35,43 @@
__declspec(selectany) int _fltused = 1;
#endif
/* The optimizer on Visual Studio 2010 generates memcpy() calls */
#if _MSC_VER == 1600 && defined(_WIN64) && !defined(_DEBUG)
#include <intrin.h>
#pragma function(memcpy)
void * memcpy ( void * destination, const void * source, size_t num )
{
const Uint8 *src = (const Uint8 *)source;
Uint8 *dst = (Uint8 *)destination;
size_t i;
/* All WIN64 architectures have SSE, right? */
if (!((uintptr_t) src & 15) && !((uintptr_t) dst & 15)) {
__m128 values[4];
for (i = num / 64; i--;) {
_mm_prefetch(src, _MM_HINT_NTA);
values[0] = *(__m128 *) (src + 0);
values[1] = *(__m128 *) (src + 16);
values[2] = *(__m128 *) (src + 32);
values[3] = *(__m128 *) (src + 48);
_mm_stream_ps((float *) (dst + 0), values[0]);
_mm_stream_ps((float *) (dst + 16), values[1]);
_mm_stream_ps((float *) (dst + 32), values[2]);
_mm_stream_ps((float *) (dst + 48), values[3]);
src += 64;
dst += 64;
}
num &= 63;
}
while (num--) {
*dst++ = *src++;
}
return destination;
}
#endif /* _MSC_VER == 1600 && defined(_WIN64) && !defined(_DEBUG) */
#ifdef _M_IX86
void
@ -697,7 +734,7 @@ RETZERO:
/* *INDENT-ON* */
}
#endif /* _WIN64 */
#endif /* _M_IX86 */
#endif /* MSC_VER */