Skip to content

Commit

Permalink
src/rust: core count starts at zero
Browse files Browse the repository at this point in the history
  • Loading branch information
Daru-san committed Oct 27, 2024
1 parent 973a5f0 commit 21a0e09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rust/src/sys/cpu/cpu_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn cpu_core_usage(core_index: i32) -> f32 {

let core_count = num_cpus::get() as i32;

assert!(core_index <= core_count && core_index >= 1);
assert!(core_index <= core_count && core_index >= 0);

let cpu_core: &Cpu = &sys.cpus()[core_index as usize];

Expand Down

0 comments on commit 21a0e09

Please sign in to comment.