mirror of https://github.com/odrling/Aegisub
FFmpegSource2: more portability
Originally committed to SVN as r2360.
This commit is contained in:
parent
27bdad5355
commit
b740812951
|
@ -21,24 +21,25 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# include <intrin.h>
|
# include <intrin.h>
|
||||||
#else
|
|
||||||
# include <xmmintrin.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int GetCPUFlags() {
|
int GetCPUFlags() {
|
||||||
|
// FIXME Add proper feature detection when msvc isn't used
|
||||||
|
int Flags = PP_CPU_CAPS_MMX | PP_CPU_CAPS_MMX2;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
Flags = 0;
|
||||||
int CPUInfo[4];
|
int CPUInfo[4];
|
||||||
__cpuid(CPUInfo, 0);
|
__cpuid(CPUInfo, 0);
|
||||||
|
|
||||||
int Flags = 0;
|
|
||||||
|
|
||||||
// PP and SWS defines have the same values for their defines so this actually works
|
// PP and SWS defines have the same values for their defines so this actually works
|
||||||
if (CPUInfo[3] & (1 << 23))
|
if (CPUInfo[3] & (1 << 23))
|
||||||
Flags |= PP_CPU_CAPS_MMX;
|
Flags |= PP_CPU_CAPS_MMX;
|
||||||
if (CPUInfo[3] & (1 << 25))
|
if (CPUInfo[3] & (1 << 25))
|
||||||
Flags |= PP_CPU_CAPS_MMX2;
|
Flags |= PP_CPU_CAPS_MMX2;
|
||||||
|
#endif
|
||||||
|
|
||||||
return Flags;
|
return Flags;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue