mirror of
https://github.com/anrieff/libcpuid
synced 2024-12-16 16:35:45 +00:00
Fix floating point exception in cpu_identify_all() for unsupported CPU vendors
This commit is contained in:
parent
d8e9f3d58e
commit
7974741993
1 changed files with 1 additions and 1 deletions
|
@ -1352,7 +1352,7 @@ int cpu_identify_all(struct cpu_raw_data_array_t* raw_array, struct system_id_t*
|
|||
}
|
||||
else {
|
||||
/* Note: if SMT is disabled by BIOS, smt_divisor will no reflect the current state properly */
|
||||
is_smt_supported = (system->cpu_types[cpu_type_index].num_logical_cpus % system->cpu_types[cpu_type_index].num_cores) == 0;
|
||||
is_smt_supported = system->cpu_types[cpu_type_index].num_cores > 0 ? (system->cpu_types[cpu_type_index].num_logical_cpus % system->cpu_types[cpu_type_index].num_cores) == 0 : false;
|
||||
smt_divisor = is_smt_supported ? system->cpu_types[cpu_type_index].num_logical_cpus / system->cpu_types[cpu_type_index].num_cores : 1.0;
|
||||
system->cpu_types[cpu_type_index].num_cores = (int32_t) num_logical_cpus / smt_divisor;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue