bit_arch 0.2.0

High-level zero-cost bit manipulation
Documentation
arch_specific!(
#[doc = "Extracts and isolates the lowest clear bit from `x`. Algorithm: `x | !x.wrapping_add(1)`"]
isolate_lowest_clear_u32(x: u32) -> u32 {
    x | !x.wrapping_add(1)
}, "tbm" = core::arch::x86_64::_blci_u32);

arch_specific!(
#[doc = "Extracts and isolates the lowest clear bit from `x`. Algorithm: `x | !x.wrapping_add(1)`"]
isolate_lowest_clear_u64(x: u64) -> u64 {
    x | !x.wrapping_add(1)
}, "tbm" = core::arch::x86_64::_blci_u64);

arch_specific!(
#[doc = "Sets the least significant zero bit from `x`. Algorithm: `x | x.wrapping_add(1)`"]
set_lowest_zero_u32(x: u32) -> u32 {
    x | x.wrapping_add(1)
}, "tbm" = core::arch::x86_64::_blcs_u32);

arch_specific!(
#[doc = "Sets the least significant zero bit from `x`. Algorithm: `x | x.wrapping_add(1)`"]
set_lowest_zero_u64(x: u64) -> u64 {
    x | x.wrapping_add(1)
}, "tbm" = core::arch::x86_64::_blcs_u64);

arch_specific!(
#[doc = "Clears the least significant set bit and sets the rest. Algorithm: `!x | x.wrapping_sub(1)`"]
complement_lowest_set_u32(x: u32) -> u32 {
    !x | x.wrapping_sub(1)
}, "tbm" = core::arch::x86_64::_blsic_u32);

arch_specific!(
#[doc = "Clears the least significant set bit and sets the rest. Algorithm: `!x | x.wrapping_sub(1)`"]
complement_lowest_set_u64(x: u64) -> u64 {
    !x | x.wrapping_sub(1)
}, "tbm" = core::arch::x86_64::_blsic_u64);

arch_specific!(
#[doc = "Sets the least significant zero bit and clears the rest. Algorithm: `!x & x.wrapping_add(1)`"]
set_lowest_clear_u32(x: u32) -> u32 {
    !x & x.wrapping_add(1)
}, "tbm" = core::arch::x86_64::_blcic_u32);

arch_specific!(
#[doc = "Sets the least significant zero bit and clears the rest. Algorithm: `!x & x.wrapping_add(1)`"]
set_lowest_clear_u64(x: u64) -> u64 {
    !x & x.wrapping_add(1)
}, "tbm" = core::arch::x86_64::_blcic_u64);

arch_specific!(
#[doc = "Sets all bits below the least significant one. Algorithm: `x | x.wrapping_sub(1)`"]
from_lowest_set_u32(x: u32) -> u32 {
    x | x.wrapping_sub(1)
}, "tbm" = core::arch::x86_64::_blsfill_u32);

arch_specific!(
#[doc = "Sets all bits below the least significant one. Algorithm: `x | x.wrapping_sub(1)`"]
from_lowest_set_u64(x: u64) -> u64 {
    x | x.wrapping_sub(1)
}, "tbm" = core::arch::x86_64::_blsfill_u64);

arch_specific!(
#[doc = "Mask from trailing zeros of `x`. Algorithm: `!x & x.wrapping_sub(1)`"]
trailing_zero_mask_u32(x: u32) -> u32 {
    !x & x.wrapping_sub(1)
}, "tbm" = core::arch::x86_64::_tzmsk_u32);

arch_specific!(
#[doc = "Mask from trailing zeros of `x`. Algorithm: `!x & x.wrapping_sub(1)`"]
trailing_zero_mask_u64(x: u64) -> u64 {
    !x & x.wrapping_sub(1)
}, "tbm" = core::arch::x86_64::_tzmsk_u64);

arch_specific!(
#[doc = "Inverse mask from trailing ones of `x`. Algorithm: `!x | x.wrapping_add(1)`"]
trailing_one_mask_u32(x: u32) -> u32 {
    !x | x.wrapping_add(1)
}, "tbm" = core::arch::x86_64::_t1mskc_u32);

arch_specific!(
#[doc = "Inverse mask from trailing ones of `x`. Algorithm: `!x | x.wrapping_add(1)`"]
trailing_one_mask_u64(x: u64) -> u64 {
    !x | x.wrapping_add(1)
}, "tbm" = core::arch::x86_64::_t1mskc_u64);