Merge pull request #2787 from lioncash/memset

CPUDetect: Remove a memset call on the this pointer
This commit is contained in:
Markus Wick 2015-08-04 17:43:36 +02:00
commit 19af6e0d93
2 changed files with 36 additions and 38 deletions

View File

@ -18,50 +18,50 @@ enum CPUVendor
struct CPUInfo
{
CPUVendor vendor;
CPUVendor vendor = VENDOR_INTEL;
char cpu_string[0x41];
char brand_string[0x21];
bool OS64bit;
bool CPU64bit;
bool Mode64bit;
char cpu_string[0x41] = {};
char brand_string[0x21] = {};
bool OS64bit = false;
bool CPU64bit = false;
bool Mode64bit = false;
bool HTT;
int num_cores;
int logical_cpu_count;
bool HTT = false;
int num_cores = 0;
int logical_cpu_count = 0;
bool bSSE;
bool bSSE2;
bool bSSE3;
bool bSSSE3;
bool bPOPCNT;
bool bSSE4_1;
bool bSSE4_2;
bool bLZCNT;
bool bSSE4A;
bool bAVX;
bool bAVX2;
bool bBMI1;
bool bBMI2;
bool bFMA;
bool bFMA4;
bool bAES;
bool bSSE = false;
bool bSSE2 = false;
bool bSSE3 = false;
bool bSSSE3 = false;
bool bPOPCNT = false;
bool bSSE4_1 = false;
bool bSSE4_2 = false;
bool bLZCNT = false;
bool bSSE4A = false;
bool bAVX = false;
bool bAVX2 = false;
bool bBMI1 = false;
bool bBMI2 = false;
bool bFMA = false;
bool bFMA4 = false;
bool bAES = false;
// FXSAVE/FXRSTOR
bool bFXSR;
bool bMOVBE;
bool bFXSR = false;
bool bMOVBE = false;
// This flag indicates that the hardware supports some mode
// in which denormal inputs _and_ outputs are automatically set to (signed) zero.
bool bFlushToZero;
bool bLAHFSAHF64;
bool bLongMode;
bool bAtom;
bool bFlushToZero = false;
bool bLAHFSAHF64 = false;
bool bLongMode = false;
bool bAtom = false;
// ARMv8 specific
bool bFP;
bool bASIMD;
bool bCRC32;
bool bSHA1;
bool bSHA2;
bool bFP = false;
bool bASIMD = false;
bool bCRC32 = false;
bool bSHA1 = false;
bool bSHA2 = false;
// Call Detect()
explicit CPUInfo();

View File

@ -61,7 +61,6 @@ CPUInfo::CPUInfo()
// Detects the various CPU features
void CPUInfo::Detect()
{
memset(this, 0, sizeof(*this));
#ifdef _M_X86_64
Mode64bit = true;
OS64bit = true;
@ -79,7 +78,6 @@ void CPUInfo::Detect()
// Assume CPU supports the CPUID instruction. Those that don't can barely
// boot modern OS:es anyway.
int cpu_id[4];
memset(brand_string, 0, sizeof(brand_string));
// Detect CPU's CPUID capabilities, and grab CPU string
__cpuid(cpu_id, 0x00000000);