diff options
Diffstat (limited to 'vendor/rustix/src/backend/linux_raw/process/cpu_set.rs')
-rw-r--r-- | vendor/rustix/src/backend/linux_raw/process/cpu_set.rs | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs b/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs deleted file mode 100644 index 35146cf..0000000 --- a/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs +++ /dev/null @@ -1,46 +0,0 @@ -//! Rust implementation of the `CPU_*` macro API. - -#![allow(non_snake_case)] - -use super::types::RawCpuSet; -use core::mem::size_of_val; - -#[inline] -pub(crate) fn CPU_SET(cpu: usize, cpuset: &mut RawCpuSet) { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] |= 1 << offset -} - -#[inline] -pub(crate) fn CPU_ZERO(cpuset: &mut RawCpuSet) { - cpuset.bits.fill(0) -} - -#[inline] -pub(crate) fn CPU_CLR(cpu: usize, cpuset: &mut RawCpuSet) { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] &= !(1 << offset) -} - -#[inline] -pub(crate) fn CPU_ISSET(cpu: usize, cpuset: &RawCpuSet) -> bool { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); - let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - (cpuset.bits[idx] & (1 << offset)) != 0 -} - -#[inline] -pub(crate) fn CPU_COUNT_S(size_in_bytes: usize, cpuset: &RawCpuSet) -> u32 { - let size_of_mask = size_of_val(&cpuset.bits[0]); - let idx = size_in_bytes / size_of_mask; - cpuset.bits[..idx] - .iter() - .fold(0, |acc, i| acc + i.count_ones()) -} - -#[inline] -pub(crate) fn CPU_COUNT(cpuset: &RawCpuSet) -> u32 { - CPU_COUNT_S(core::mem::size_of::<RawCpuSet>(), cpuset) -} |