arch_specific!(
#[doc = "Extracts the value by shifting bits in `x` specified by `mask` to low contiguous bits."]
extract_u32(x: u32, mask: u32) -> u32 {
let mut result = 0;
let mut bb = 1;
while mask != 0 {
if x & super::isolate_lowest_set_u32(mask) != 0 {
result |= bb;
}
mask &= mask - 1;
bb += bb;
}
result
}, "bmi2" = core::arch::x86_64::_pext_u32);
arch_specific!(
#[doc = "Extracts the value by shifting bits in `x` specified by `mask` to low contiguous bits."]
extract_u64(x: u64, mask: u64) -> u64 {
let mut result = 0;
let mut bb = 1;
while mask != 0 {
if x & super::isolate_lowest_set_u64(mask) != 0 {
result |= bb;
}
mask &= mask - 1;
bb += bb;
}
result
}, "bmi2" = core::arch::x86_64::_pext_u64);
arch_specific!(
#[doc = "Deposits the value by shifting low bits in `x` to positions specified by mask."]
deposit_u32(x: u32, mask: u32) -> u32 {
let mut result = 0;
let mut bb = 1;
while mask != 0 {
if (x & bb) != 0 {
result |= super::isolate_lowest_set_u32(mask);
}
mask &= mask - 1;
bb += bb;
}
result
}, "bmi2" = core::arch::x86_64::_pdep_u32);
arch_specific!(
#[doc = "Deposits the value by shifting low bits in `x` to positions specified by mask."]
deposit_u64(x: u64, mask: u64) -> u64 {
let mut result = 0;
let mut bb = 1;
while mask != 0 {
if (x & bb) != 0 {
result |= super::isolate_lowest_set_u64(mask);
}
mask &= mask - 1;
bb += bb;
}
result
}, "bmi2" = core::arch::x86_64::_pdep_u64);
arch_specific!(
#[doc = "Zeros all bits above `index` in `x`."]
zero_upper_u32(x: u32, index: u32) -> u32 {
if index > 31 {
return u32::MAX;
}
x & ((1u32 << index) - 1)
}, "bmi2" = core::arch::x86_64::_bzhi_u32);
arch_specific!(
#[doc = "Zeros all bits above `index` in `x`."]
zero_upper_u64(x: u64, index: u32) -> u64 {
if index > 63 {
return u64::MAX;
}
x & ((1u64 << index) - 1)
}, "bmi2" = core::arch::x86_64::_bzhi_u64);