@clz

@clz

@clz(comptime T: type, integer: T)

This function counts the number of most-significant (leading in a big-Endian sense) zeroes in integer.

If integer is known at comptime, the return type is comptime_int. Otherwise, the return type is an unsigned integer with the minimum number of bits that can represent the bit count of the integer type.

If integer is zero, @clz returns the bit width of integer type T.

See also:

  • @ctz
  • @popCount