Trait bitintr::Tzcnt
[−]
[src]
pub trait Tzcnt { fn tzcnt(self) -> Self; }
Counts trailing zero bits
Required Methods
fn tzcnt(self) -> Self
Counts the number of trailing least significant zero bits.
When the source operand is 0, it returns its size in bits.
This is equivalent to searching for the least significant set bit and returning its index.
Keywords: Count trailing zeros, Bit scan forward, find first set.
Instructions
TZCNT
:- Description: Count the number of trailing zero bits.
- Architecture: x86.
- Instruction set: BMI.
- Registers: 16/32/64 bit.
Example
assert_eq!(0b1001_0000_u16.tzcnt(), 4_u16); assert_eq!(0b0000_0000_u32.tzcnt(), 32_u32); assert_eq!(0b0000_0001_u64.tzcnt(), 0_u64);
Implementors
impl Tzcnt for u8
impl Tzcnt for u16
impl Tzcnt for u32
impl Tzcnt for u64
impl Tzcnt for i8
impl Tzcnt for i16
impl Tzcnt for i32
impl Tzcnt for i64