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

View File

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