Function for counting number of set bits?

i.e. the number of 1 bits in a bits-type. I read somewhere that this is actually an x86 instruction, so if that’s the case, I’d very much like to use that. I can’t seem to find this in the documentation…

1 Like

count_ones is your friend :slight_smile:

6 Likes

Oh the irony, considering the debate raging in the (probably soon to be infamous) underscores thread :laughing:

6 Likes

Note that the Julia contributing guide clearly states that method names should be lower case with underscores! (That part was added by Jake Bolewski, back 3 years ago, in #9848)
Nobody disagreed, the only discussion on the PR was about the choice of 92 characters per line!

1 Like