Function bitintr::abm::lzcnt [] [src]

pub fn lzcnt<T: Int>(x: T) -> T

Counts the leading most significant zero bits.

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

Keywords: Count leading zeros, bit scan reverse, find last set.

Intrinsic (when available: ABM / SSE4.2)

LZCNT: Count the number of leading zero bits (supports 16/32/64 bit registers).

Note: This instruction is officialy part of BMI1 but Intel and AMD CPUs advertise it as being part of ABM.

Example

use bitintr::abm::lzcnt;

assert_eq!(lzcnt(0b0101_1010u16), 9u16);