Merge pull request #1741 from kubo39/patch-CPU_ALLOC_SIZE
Add CPU_ALLOC_SIZE
This commit is contained in:
commit
1da0baa684
@ -2620,6 +2620,12 @@ f! {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn CPU_ALLOC_SIZE(count: ::c_int) -> ::size_t {
|
||||
let _dummy: cpu_set_t = ::mem::zeroed();
|
||||
let size_in_bits = 8 * ::mem::size_of_val(&_dummy.bits[0]);
|
||||
((count as ::size_t + size_in_bits - 1) / 8) as ::size_t
|
||||
}
|
||||
|
||||
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
|
||||
for slot in cpuset.bits.iter_mut() {
|
||||
*slot = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user