Function bitintr::x86::abm::popcnt [] [src]

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

Counts the bits that are set.

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

Assembly Instructions

Example

use bitintr::x86::abm::*;
assert_eq!(popcnt(0b0101_1010u16), 4);
assert_eq!(0b0101_1010u16.popcnt(), 4);