Tuesday, 12 April 2016

c# - Count the number of bits that are "on" in a byte


Possible Duplicates:
Count the number of set bits in an integer
Best algorithm to count the number of set bits in a 32-bit integer?







That's an exam question and that is all I have - "Count the number of bits that are "on" in a byte" "On" means 1, I assume. Do I need to create a BitArray, randomly populate it and then iterate through it or is there a different way?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...