Merge pull request #188 from gjaegy/master
fix crash on CPU not having AVX support
This commit is contained in:
@@ -55,10 +55,16 @@ public:
|
|||||||
{
|
{
|
||||||
int cpuInfo[4];
|
int cpuInfo[4];
|
||||||
memset(cpuInfo, 0, sizeof(cpuInfo));
|
memset(cpuInfo, 0, sizeof(cpuInfo));
|
||||||
unsigned long long sseExt;
|
unsigned long long sseExt = 0;
|
||||||
__cpuid(cpuInfo, 1);
|
__cpuid(cpuInfo, 1);
|
||||||
sseExt = _xgetbv(0);
|
|
||||||
|
|
||||||
|
bool osUsesXSAVE_XRSTORE = cpuInfo[2] & (1 << 27) || false;
|
||||||
|
bool cpuAVXSuport = cpuInfo[2] & (1 << 28) || false;
|
||||||
|
|
||||||
|
if (osUsesXSAVE_XRSTORE && cpuAVXSuport)
|
||||||
|
{
|
||||||
|
sseExt = _xgetbv(0);
|
||||||
|
}
|
||||||
const int OSXSAVEFlag = (1UL << 27);
|
const int OSXSAVEFlag = (1UL << 27);
|
||||||
const int AVXFlag = ((1UL << 28) | OSXSAVEFlag);
|
const int AVXFlag = ((1UL << 28) | OSXSAVEFlag);
|
||||||
const int FMAFlag = ((1UL << 12) | AVXFlag | OSXSAVEFlag);
|
const int FMAFlag = ((1UL << 12) | AVXFlag | OSXSAVEFlag);
|
||||||
|
|||||||
Reference in New Issue
Block a user