[][src]Trait bitintr::Lzcnt

pub trait Lzcnt {
    fn clz(self) -> Self;
fn lzcnt(self) -> Self; }

Count leading zeros

Required methods

fn clz(self) -> Self

Count Leading Zeros.

See lzcnt.

fn lzcnt(self) -> Self

Counts the leading most significant zero bits.

When the operand is zero, it returns its size in bits.

Keywords: Leading Zeros Count, Count Leading Zeros, Bit Scan Severse, Find Last Set.

See also arm::v7::clz.

Instructions

  • LZCNT:

    • Description: Count the number of leading zero bits.
    • Architecture: x86.
    • Instruction set: ABM, BMI.
    • Registers: 16/32/64 bit.
  • Note: This instruction is officially part of BMI1 but Intel (and AMD) CPUs advertise it as being part of ABM.

  • [CLZ](https://www.pjrc.com/teensy/beta/ DDI0403D_arm_architecture_v7m_reference_manual.pdf):

    • Description: Count Leading Zeros.
    • Architecture: ARM.
    • Instruction set: v7.
    • Registers: 8/16/32 bit.

Example

assert_eq!(0b0101_1010u16.clz(), 9u16);
assert_eq!(0b0101_1010u16.lzcnt(), 9u16);
Loading content...

Implementors

impl Lzcnt for i8[src]

impl Lzcnt for i16[src]

impl Lzcnt for i32[src]

impl Lzcnt for i64[src]

impl Lzcnt for u8[src]

impl Lzcnt for u16[src]

impl Lzcnt for u32[src]

impl Lzcnt for u64[src]

Loading content...