I don't know any built-in function to count bits. You can use this Sub
B4X:
Sub CountSetBits( dataByte As Byte) As Int
Dim k, bitCount As Int
For k=0 To 7
If Bit.And( dataByte, Bit.ShiftLeft(1, k) )<>0 Then bitCount = bitCount+1
Next
Return bitCount
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.