@@ -1154,9 +1154,10 @@ static void ParseCpuId(const uint32_t max_cpuid_leaf, X86Info* info, OsSupport*
11541154}
11551155
11561156// Reference https://en.wikipedia.org/wiki/CPUID#EAX=80000000h:_Get_Highest_Extended_Function_Implemented.
1157- static void ParseExtraAMDCpuId (const uint32_t max_cpuid_leaf , X86Info * info , OsSupport os_support ) {
1157+ static void ParseExtraAMDCpuId (X86Info * info , OsSupport os_support ) {
11581158 const Leaf leaf_80000000 = CpuId (0x80000000 );
1159- const Leaf leaf_80000001 = SafeCpuId (leaf_80000000 .eax , 0x80000001 );
1159+ const uint32_t max_extended_cpuid_leaf = leaf_80000000 .eax ;
1160+ const Leaf leaf_80000001 = SafeCpuId (max_extended_cpuid_leaf , 0x80000001 );
11601161
11611162 X86Features * const features = & info -> features ;
11621163
@@ -1177,13 +1178,15 @@ X86Info GetX86Info(void) {
11771178 X86Info info = kEmptyX86Info ;
11781179 OsSupport os_support = kEmptyOsSupport ;
11791180 const Leaf leaf_0 = CpuId (0 );
1180- const uint32_t max_cpuid_leaf = leaf_0 .eax ;
1181+ const bool is_intel = IsVendor (leaf_0 , "GenuineIntel" );
1182+ const bool is_amd = IsVendor (leaf_0 , "AuthenticAMD" );
11811183 SetVendor (leaf_0 , info .vendor );
1182- if (IsVendor (leaf_0 , "GenuineIntel" ) || IsVendor (leaf_0 , "AuthenticAMD" )) {
1184+ if (is_intel || is_amd ) {
1185+ const uint32_t max_cpuid_leaf = leaf_0 .eax ;
11831186 ParseCpuId (max_cpuid_leaf , & info , & os_support );
11841187 }
1185- if (IsVendor ( leaf_0 , "AuthenticAMD" ) ) {
1186- ParseExtraAMDCpuId (max_cpuid_leaf , & info , os_support );
1188+ if (is_amd ) {
1189+ ParseExtraAMDCpuId (& info , os_support );
11871190 }
11881191 return info ;
11891192}
0 commit comments