For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
count_leading_zeros
count_leading_zeros(val: Int) -> Int
Counts the number of leading zeros of an integer.
Args:
- val (
Int): The input value.
Returns:
Int: The number of leading zeros of the input.
count_leading_zeros[dtype: DType, width: Int, //](val: SIMD[dtype, width]) -> SIMD[dtype, width]
Counts the per-element number of leading zeros in a SIMD vector.
Constraints:
The element type of the input vector must be integral.
Parameters:
Args:
- val (
SIMD[dtype, width]): The input value.
Returns:
SIMD[dtype, width]: A SIMD value where the element at position i contains the number of
leading zeros at position i of the input value.