Saturday 27 July 2019

algorithm - How to count the number of set bits in a 32-bit integer?

8 bits representing the number 7 look like this:



00000111


Three bits are set.




What are algorithms to determine the number of set bits in a 32-bit integer?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...