Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions examples/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@
let mut all_x2apic_ids: Vec<u32> = gather_all_x2apic_ids();
all_x2apic_ids.sort_unstable();
for x2apic_id in all_x2apic_ids {
let smt_select_mask = !(u32::max_value() << smt_x2apic_shift);

Check warning on line 96 in examples/topology.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

use of deprecated associated function `core::num::<impl u32>::max_value`: replaced by the `MAX` associated constant on this type
let core_select_mask = (!((u32::max_value()) << core_x2apic_shift)) ^ smt_select_mask;

Check warning on line 97 in examples/topology.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

use of deprecated associated function `core::num::<impl u32>::max_value`: replaced by the `MAX` associated constant on this type
let pkg_select_mask = u32::max_value() << core_x2apic_shift;

Check warning on line 98 in examples/topology.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

use of deprecated associated function `core::num::<impl u32>::max_value`: replaced by the `MAX` associated constant on this type

let smt_id = x2apic_id & smt_select_mask;
let core_id = (x2apic_id & core_select_mask) >> smt_x2apic_shift;
Expand Down Expand Up @@ -146,10 +146,7 @@
}
}

return (
max_logical_processor_ids as u8,
smt_max_cores_for_package as u8,
);
return (max_logical_processor_ids, smt_max_cores_for_package);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return (max_logical_processor_ids, smt_max_cores_for_package);
(max_logical_processor_ids, smt_max_cores_for_package)

lgtm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I need to keep the return keyword, as the return statement is inside an if.

}

unreachable!("Example doesn't support this CPU")
Expand All @@ -161,11 +158,11 @@
let smt_mask_width: u8 = cpuid_bits_needed(
(max_logical_processor_ids.next_power_of_two() / smt_max_cores_for_package) - 1,
);
let smt_select_mask: u8 = !(u8::max_value() << smt_mask_width);

Check warning on line 161 in examples/topology.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

use of deprecated associated function `core::num::<impl u8>::max_value`: replaced by the `MAX` associated constant on this type
let core_mask_width: u8 = cpuid_bits_needed(smt_max_cores_for_package - 1);
let core_only_select_mask =
(!(u8::max_value() << (core_mask_width + smt_mask_width))) ^ smt_select_mask;

Check warning on line 164 in examples/topology.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

use of deprecated associated function `core::num::<impl u8>::max_value`: replaced by the `MAX` associated constant on this type
let pkg_select_mask = u8::max_value() << (core_mask_width + smt_mask_width);

Check warning on line 165 in examples/topology.rs

View workflow job for this annotation

GitHub Actions / ci (nightly)

use of deprecated associated function `core::num::<impl u8>::max_value`: replaced by the `MAX` associated constant on this type

println!("Enumeration of all cores in the system (with APIC IDs):");
let mut all_xapic_ids: Vec<u8> = gather_all_xapic_ids();
Expand Down
Loading