Skip to main content

function

reduce_bit_count

reduce_bit_count[type: DType, simd_width: Int](val: SIMD[type, simd_width]) -> Int

Returns a scalar containing total number of bits set in given vector.

Parameters:

  • type (DType): The dtype of the input SIMD vector. Constraints: must be either an integral or a boolean type.
  • simd_width (Int): The width of the input and output SIMD vector.

Args:

  • val (SIMD[type, simd_width]): The SIMD vector to reduce.

Returns:

Count of set bits across all elements of the vector.