#[target_feature(enable = "popcnt")]
#[cfg(any(target_feature = "popcnt", feature = "dynamic"))]
fn popcnt_u32(x: u32) -> u32 {
unsafe { x86_intr::arch::_mm_popcnt_u32(x) }.cast_unsigned()
}
#[target_feature(enable = "popcnt")]
#[cfg(any(target_feature = "popcnt", feature = "dynamic"))]
fn popcnt_u64(x: u64) -> u64 {
unsafe { x86_intr::arch::_mm_popcnt_u64(x) }.cast_unsigned()
}
arch_specific!(
#[doc = "Counts bits that are one of `x`."]
count_ones_u32(x: u32) -> u32 {
x.count_ones()
}, "popcnt" = popcnt_u32);
arch_specific!(
#[doc = "Counts bits that are one of `x`."]
count_ones_u64(x: u64) -> u64 {
x.count_ones() as u64
}, "popcnt" = popcnt_u64);
arch_specific!(
#[doc = "Counts bits that are one of `x`."]
count_ones_i32(x: i32) -> i32 {
x.count_ones().cast_signed()
}, "popcnt" = core::arch::x86_64::_popcnt32);
arch_specific!(
#[doc = "Counts bits that are one of `x`."]
count_ones_i64(x: i64) -> i32 {
x.count_ones().cast_signed()
}, "popcnt" = core::arch::x86_64::_popcnt64);
arch_specific!(
#[doc = "Counts leading zero bits of `x`."]
leading_zeros_u32(x: u32) -> u32 {
x.leading_zeros()
}, "lzcnt" = core::arch::x86_64::_lzcnt_u32);
arch_specific!(
#[doc = "Counts leading zero bits of `x`."]
leading_zeros_u64(x: u64) -> u64 {
x.leading_zeros() as u64
}, "lzcnt" = core::arch::x86_64::_lzcnt_u64);