1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-11-10 22:59:13 +00:00

Fix warnings in cpuid_main.c

D:\a\libcpuid\libcpuid\libcpuid\cpuid_main.c(1192,82): warning C4244: '=': conversion from 'double' to 'int32_t', possible loss of data [D:\a\libcpuid\libcpuid\libcpuid\libcpuid_vc10.vcxproj]
  D:\a\libcpuid\libcpuid\libcpuid\cpuid_main.c(1283,23): warning C4018: '<': signed/unsigned mismatch [D:\a\libcpuid\libcpuid\libcpuid\libcpuid_vc10.vcxproj]
This commit is contained in:
The Tumultuous Unicorn Of Darkness 2022-11-11 17:49:21 +01:00
parent 94930cb891
commit d84493e6ca
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A

View file

@ -1189,7 +1189,7 @@ int cpu_identify_all(struct cpu_raw_data_array_t* raw_array, struct system_id_t*
/* 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;
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 = num_logical_cpus / smt_divisor;
system->cpu_types[cpu_type_index].num_cores = (int32_t) num_logical_cpus / smt_divisor;
}
/* Save current values in system->cpu_types[cpu_type_index] and reset values for the next purpose */
system->cpu_types[cpu_type_index].num_logical_cpus = num_logical_cpus;
@ -1280,7 +1280,7 @@ char* affinity_mask_str_r(cpu_affinity_mask_t* affinity_mask, char* buffer, uint
logical_cpu_t str_index = 0;
bool do_print = false;
while (str_index + 1 < buffer_len) {
while (((uint32_t) str_index) + 1 < buffer_len) {
if (do_print || (mask_index < 4) || (affinity_mask->__bits[mask_index] != 0x00)) {
snprintf(&buffer[str_index], 3, "%02X", affinity_mask->__bits[mask_index]);
do_print = true;