From c9ecaea31c70f09171675f5b0c7721e11cf0756a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 21 Jun 2007 18:20:59 +0000 Subject: [PATCH] Fixes for Visual C++ 6.0 with and without the Processor Pack. --- include/SDL_config_win32.h | 11 +++++++++++ src/video/SDL_blit_A.c | 30 +++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/include/SDL_config_win32.h b/include/SDL_config_win32.h index 8d32b13cd..ea4204f71 100644 --- a/include/SDL_config_win32.h +++ b/include/SDL_config_win32.h @@ -46,6 +46,17 @@ typedef unsigned int uintptr_t; #endif #define _UINTPTR_T_DEFINED #endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +#endif +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +#endif +#ifndef GWLP_HINSTANCE +#define GWLP_HINSTANCE GWL_HINSTANCE +#endif +#endif #else /* !__GNUC__ && !_MSC_VER */ typedef signed char int8_t; typedef unsigned char uint8_t; diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c index 9319d1e3c..b46d3f613 100644 --- a/src/video/SDL_blit_A.c +++ b/src/video/SDL_blit_A.c @@ -24,14 +24,30 @@ #include "SDL_video.h" #include "SDL_blit.h" +/* + In Visual C, VC6 has mmintrin.h in the "Processor Pack" add-on. + Checking if _mm_free is #defined in malloc.h is is the only way to + determine if the Processor Pack is installed, as far as I can tell. +*/ + #if SDL_ASSEMBLY_ROUTINES -#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -#define MMX_ASMBLIT 1 -#define GCC_ASMBLIT 1 -#elif defined(_MSC_VER) && (_MSC_VER >= 1200) && defined(_M_IX86) -#define MMX_ASMBLIT 1 -#define MSVC_ASMBLIT 1 -#endif +# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# define MMX_ASMBLIT 1 +# define GCC_ASMBLIT 1 +# elif defined(_MSC_VER) && defined(_M_IX86) +# if (_MSC_VER <= 1200) +# include +# if defined(_mm_free) +# define HAVE_MMINTRIN_H 1 +# endif +# else /* Visual Studio > VC6 always has mmintrin.h */ +# define HAVE_MMINTRIN_H 1 +# endif +# if HAVE_MMINTRIN_H +# define MMX_ASMBLIT 1 +# define MSVC_ASMBLIT 1 +# endif +# endif #endif /* SDL_ASSEMBLY_ROUTINES */ /* Function to check the CPU flags */