changeset 746:72ef7ce609ef

Greatly simplified the SDL CPU info code
author Sam Lantinga <slouken@libsdl.org>
date Mon, 24 Nov 2003 09:22:12 +0000
parents 71ee03909f42
children da36f59485da
files src/audio/SDL_mixer.c src/audio/SDL_mixer_MMX_VC.c src/audio/SDL_mixer_MMX_VC.h
diffstat 3 files changed, 5 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/SDL_mixer.c	Mon Nov 24 09:16:52 2003 +0000
+++ b/src/audio/SDL_mixer.c	Mon Nov 24 09:22:12 2003 +0000
@@ -146,7 +146,7 @@
 			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 @@
 			}
 			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);
 			}
--- a/src/audio/SDL_mixer_MMX_VC.c	Mon Nov 24 09:16:52 2003 +0000
+++ b/src/audio/SDL_mixer_MMX_VC.c	Mon Nov 24 09:22:12 2003 +0000
@@ -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 <windows.h>
 #include <stdio.h>
 
@@ -152,54 +152,4 @@
 	}
 }
 
-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 */
--- a/src/audio/SDL_mixer_MMX_VC.h	Mon Nov 24 09:16:52 2003 +0000
+++ b/src/audio/SDL_mixer_MMX_VC.h	Mon Nov 24 09:22:12 2003 +0000
@@ -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
-
-