25.14.1 popcount

The popcount function has the prototype:

fun popcount = (any integer_or_offset) int<32>:
{ ... }

It returns number of 1 bits in the given input integer_or_offset.

Examples:

assert (popcount (1) == 1);
assert (popcount (5) == 2);
assert (popcount (-1) == 32);
assert (popcount (-1L) == 64);
assert (popcount (0#B) == 0);
assert (popcount (0xff#B) == 8);