Trait bitintr::Cls [] [src]

pub trait Cls {
    fn cls(self) -> Self;
}

Count leading sign bits

Required Methods

Counts the leading most significant bits set.

When all bits of the operand are set it returns the size of the operand in bits.

Keywords: count leading sign bits, count leading ones, count leading bits set.

Instructions

  • CLS:
    • Description: Count leading sign bits.
    • Architecture: ARMv8.
    • Registers: 32/64 bits.

Example

let n = 0b1111_1111_1100_1010_u16;
assert_eq!(n.cls(), 9);
assert_eq!(0b1111_1111_u8.cls(), 7);

Implementors