[][src]Trait bitintr::Popcnt

pub trait Popcnt {
    fn popcnt(self) -> Self;
}

Count bits set.

Required methods

fn popcnt(self) -> Self

Counts the bits that are set.

Keywords: Population count, count ones, Hamming weight, Sideways sum.

Instructions

  • POPCNT:
    • Description: Population Count.
    • Architecture: x86.
    • Instruction set: ABM, SSE 4.2.
    • Registers: 16/32/64 bit.
  • Note: Intel considers it part of SSE4.2 but advertises it with its own CPUID flag.

Example

assert_eq!(0b0101_1010u16.popcnt(), 4);
Loading content...

Implementors

impl Popcnt for i8[src]

impl Popcnt for i16[src]

impl Popcnt for i32[src]

impl Popcnt for i64[src]

impl Popcnt for u8[src]

impl Popcnt for u16[src]

impl Popcnt for u32[src]

impl Popcnt for u64[src]

Loading content...