Skip to main content

function

countl_zero

countl_zero(val: Int) -> Int

Counts the number of leading zeros of an integer.

Args:

  • val (Int): The input value.

Returns:

The number of leading zeros of the input.

countl_zero[type: DType, simd_width: Int](val: SIMD[type, simd_width]) -> SIMD[$0, $1]

Counts the per-element number of leading zeros in a SIMD vector.

Constraints:

The element type of the input vector must be integral.

Parameters:

  • type (DType): DType used for the computation.
  • simd_width (Int): SIMD width used for the computation.

Args:

  • val (SIMD[type, simd_width]): The input value.

Returns:

A SIMD value where the element at position i contains the number of leading zeros at position i of the input value.