Greatly simplified the SDL CPU info code
authorSam Lantinga <slouken@libsdl.org>
Mon, 24 Nov 2003 09:22:12 +0000
changeset 74672ef7ce609ef
parent 745 71ee03909f42
child 747 da36f59485da
Greatly simplified the SDL CPU info code
src/audio/SDL_mixer.c
src/audio/SDL_mixer_MMX_VC.c
src/audio/SDL_mixer_MMX_VC.h
     1.1 --- a/src/audio/SDL_mixer.c	Mon Nov 24 09:16:52 2003 +0000
     1.2 +++ b/src/audio/SDL_mixer.c	Mon Nov 24 09:22:12 2003 +0000
     1.3 @@ -146,7 +146,7 @@
     1.4  			else
     1.5  #endif
     1.6  #if defined(USE_ASM_MIXER_VC)
     1.7 -			if (SDL_IsMMX_VC())
     1.8 +			if (SDL_HasMMX())
     1.9  			{
    1.10  				SDL_MixAudio_MMX_S8_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
    1.11  			}
    1.12 @@ -192,7 +192,7 @@
    1.13  			}
    1.14  			else
    1.15  #elif defined(USE_ASM_MIXER_VC)
    1.16 -			if (SDL_IsMMX_VC())
    1.17 +			if (SDL_HasMMX())
    1.18  			{
    1.19  				SDL_MixAudio_MMX_S16_VC((char*)dst,(char*)src,(unsigned int)len,(int)volume);
    1.20  			}
     2.1 --- a/src/audio/SDL_mixer_MMX_VC.c	Mon Nov 24 09:16:52 2003 +0000
     2.2 +++ b/src/audio/SDL_mixer_MMX_VC.c	Mon Nov 24 09:22:12 2003 +0000
     2.3 @@ -1,3 +1,4 @@
     2.4 +#if defined(USE_ASM_MIXER_VC)
     2.5  // MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples
     2.6  // Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
     2.7  // Converted to Intel ASM notation by Cth
     2.8 @@ -11,7 +12,6 @@
     2.9  // Mixing for 16 bit signed buffers
    2.10  ////////////////////////////////////////////////
    2.11  
    2.12 -#if defined(USE_ASM_MIXER_VC)
    2.13  #include <windows.h>
    2.14  #include <stdio.h>
    2.15  
    2.16 @@ -152,54 +152,4 @@
    2.17  	}
    2.18  }
    2.19  
    2.20 -int _SDL_IsMMX_VC()
    2.21 -{
    2.22 -	// This	bit	flag can get set on	calling	cpuid
    2.23 -	// with	register eax set to	1
    2.24 -	const int _MMX_FEATURE_BIT = 0x00800000;
    2.25 -	DWORD dwFeature	= 0;
    2.26 -	__try {
    2.27 -			_asm {
    2.28 -				mov	eax,1
    2.29 -				cpuid
    2.30 -				mov	dwFeature,edx
    2.31 -			}
    2.32 -	} __except ( EXCEPTION_EXECUTE_HANDLER)	{
    2.33 -			return 0;
    2.34 -	}
    2.35 -	if (dwFeature &	_MMX_FEATURE_BIT) {
    2.36 -		__try {
    2.37 -			__asm {
    2.38 -				pxor mm0, mm0
    2.39 -				emms
    2.40 -			}
    2.41 -		} __except (EXCEPTION_EXECUTE_HANDLER) {
    2.42 -			return(0);
    2.43 -		}
    2.44 -		return 1;
    2.45 -	}
    2.46 -
    2.47 -	return 0;
    2.48 -}
    2.49 -
    2.50 -static int _notTwice = 2;
    2.51 -
    2.52 -int SDL_IsMMX_VC()
    2.53 -{
    2.54 -	if (_notTwice > 1)
    2.55 -	{
    2.56 -		_notTwice = _SDL_IsMMX_VC();
    2.57 -/*
    2.58 -#ifdef _DEBUG
    2.59 -		if (_notTwice)
    2.60 -			MessageBox( NULL, "Using MMX!!!", "Error", MB_OK | MB_ICONINFORMATION );
    2.61 -		else
    2.62 -			MessageBox( NULL, "Not sing MMX!!!", "Error", MB_OK | MB_ICONINFORMATION );
    2.63 -#endif
    2.64 -*/
    2.65 -	}
    2.66 -	return _notTwice;
    2.67 -}
    2.68 -
    2.69 -#endif
    2.70 -
    2.71 +#endif /* USE_ASM_MIXER_VC */
     3.1 --- a/src/audio/SDL_mixer_MMX_VC.h	Mon Nov 24 09:16:52 2003 +0000
     3.2 +++ b/src/audio/SDL_mixer_MMX_VC.h	Mon Nov 24 09:22:12 2003 +0000
     3.3 @@ -1,3 +1,4 @@
     3.4 +#if defined(USE_ASM_MIXER_VC)
     3.5  // headers for MMX assembler version of SDL_MixAudio
     3.6  // Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
     3.7  // Converted to Intel ASM notation by Cth
     3.8 @@ -6,10 +7,6 @@
     3.9  // Assumes buffer size in bytes is a multiple of 16
    3.10  // Assumes SDL_MIX_MAXVOLUME = 128
    3.11  
    3.12 -#if defined(USE_ASM_MIXER_VC)
    3.13  void SDL_MixAudio_MMX_S16_VC(char* ,char* ,unsigned int ,int );
    3.14  void SDL_MixAudio_MMX_S8_VC(char* ,char* ,unsigned int ,int );
    3.15 -int SDL_IsMMX_VC();
    3.16  #endif
    3.17 -
    3.18 -