bitCount()
Purpose
Returns the number of bits set (1) in a binary number
Description
Counts how many bits in a binary number are set to 1
Syntax
result = bitCount( number )
Arguments
number 32 bit signed binary number
result Number of bits set to 1 in number
Example
number = 0
for i = 0 to 16 loop
number = bitSet( number, i, 1 )
count = bitCount( number )
printAt( 0, i , number, " ", count )
update()
repeat
sleep( 3 )
Associated Commands
bitGet(), bitSet(), bitFieldExtract(), bitFieldInsert(), leadingZeroes(), trailingZeroes()