@popCount

@popCount

@popCount(comptime T: type, operand: T)

T must be an integer type.

operand may be an integer or vector.

Counts the number of bits set in an integer.

If operand is a comptime-known integer, the return type is comptime_int. Otherwise, the return type is an unsigned integer or vector of unsigned integers with the minimum number of bits that can represent the bit count of the integer type.

See also:

  • @ctz
  • @clz