Mojo function
pop_count
pop_count(val: Int) -> Int
Counts the number of bits set in an integer value.
Args:
- val (
Int
): The input value.
Returns:
Int
: The number of bits set in the input value.
pop_count[dtype: DType, width: Int, //](val: SIMD[dtype, width]) -> SIMD[dtype, width]
Counts the number of bits set in a SIMD vector of integer values.
Constraints:
The element type of the input vector must be integral.
Parameters:
Args:
- val (
SIMD
): The input value.
Returns:
SIMD
: A SIMD value where the element at position i
contains the number of
bits set in the element at position i
of the input value.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!