bit_count


bit_count(i)
      

Return the number of bits set in the integer i.

For nonnegative inputs, bit_count will return the number of bits set in the two's complement representation of i. For negative inputs, it returns a negative number whose magnitude is one greater than the number of bits not set in the two's complement representation of i.

Examples:


bit_count(5)
// 2
      

Also see:

blength


Core Module Index | Contents