Greatly simplified the SDL CPU info code

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40747
This commit is contained in:
Sam Lantinga 2003-11-24 09:22:12 +00:00
parent fb25886c0e
commit 15fabb637b
3 changed files with 5 additions and 58 deletions

View file

@ -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);
}

View file

@ -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 @@ endS8:
}
}
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 */

View file

@ -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