From 83e36e7aad82b05924432690ce04bcc390d81738 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 24 Nov 2003 09:22:12 +0000 Subject: [PATCH] Greatly simplified the SDL CPU info code --- src/audio/SDL_mixer.c | 4 +-- src/audio/SDL_mixer_MMX_VC.c | 54 ++---------------------------------- src/audio/SDL_mixer_MMX_VC.h | 5 +--- 3 files changed, 5 insertions(+), 58 deletions(-) diff --git a/src/audio/SDL_mixer.c b/src/audio/SDL_mixer.c index 126ef9146..9219fe7f2 100644 --- a/src/audio/SDL_mixer.c +++ b/src/audio/SDL_mixer.c @@ -146,7 +146,7 @@ void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume) else #endif #if defined(USE_ASM_MIXER_VC) - if (SDL_IsMMX_VC()) + if (SDL_HasMMX()) { SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume); } @@ -192,7 +192,7 @@ void SDL_MixAudio (Uint8 *dst, const Uint8 *src, Uint32 len, int volume) } else #elif defined(USE_ASM_MIXER_VC) - if (SDL_IsMMX_VC()) + if (SDL_HasMMX()) { SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume); } diff --git a/src/audio/SDL_mixer_MMX_VC.c b/src/audio/SDL_mixer_MMX_VC.c index 9f1b6cbc7..539e4c7af 100644 --- a/src/audio/SDL_mixer_MMX_VC.c +++ b/src/audio/SDL_mixer_MMX_VC.c @@ -1,3 +1,4 @@ +#if defined(USE_ASM_MIXER_VC) // MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples // Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) // Converted to Intel ASM notation by Cth @@ -11,7 +12,6 @@ // Mixing for 16 bit signed buffers //////////////////////////////////////////////// -#if defined(USE_ASM_MIXER_VC) #include #include @@ -152,54 +152,4 @@ void SDL_MixAudio_MMX_S8_VC(char* dst,char* src,unsigned int nSize,int volume) } } -int _SDL_IsMMX_VC() -{ - // This bit flag can get set on calling cpuid - // with register eax set to 1 - const int _MMX_FEATURE_BIT = 0x00800000; - DWORD dwFeature = 0; - __try { - _asm { - mov eax,1 - cpuid - mov dwFeature,edx - } - } __except ( EXCEPTION_EXECUTE_HANDLER) { - return 0; - } - if (dwFeature & _MMX_FEATURE_BIT) { - __try { - __asm { - pxor mm0, mm0 - emms - } - } __except (EXCEPTION_EXECUTE_HANDLER) { - return(0); - } - return 1; - } - - return 0; -} - -static int _notTwice = 2; - -int SDL_IsMMX_VC() -{ - if (_notTwice > 1) - { - _notTwice = _SDL_IsMMX_VC(); -/* -#ifdef _DEBUG - if (_notTwice) - MessageBox( NULL, "Using MMX!!!", "Error", MB_OK | MB_ICONINFORMATION ); - else - MessageBox( NULL, "Not sing MMX!!!", "Error", MB_OK | MB_ICONINFORMATION ); -#endif -*/ - } - return _notTwice; -} - -#endif - +#endif /* USE_ASM_MIXER_VC */ diff --git a/src/audio/SDL_mixer_MMX_VC.h b/src/audio/SDL_mixer_MMX_VC.h index bec6f607a..309cd43b6 100644 --- a/src/audio/SDL_mixer_MMX_VC.h +++ b/src/audio/SDL_mixer_MMX_VC.h @@ -1,3 +1,4 @@ +#if defined(USE_ASM_MIXER_VC) // headers for MMX assembler version of SDL_MixAudio // Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) // Converted to Intel ASM notation by Cth @@ -6,10 +7,6 @@ // Assumes buffer size in bytes is a multiple of 16 // Assumes SDL_MIX_MAXVOLUME = 128 -#if defined(USE_ASM_MIXER_VC) void SDL_MixAudio_MMX_S16_VC(char* ,char* ,unsigned int ,int ); void SDL_MixAudio_MMX_S8_VC(char* ,char* ,unsigned int ,int ); -int SDL_IsMMX_VC(); #endif - -