Function for counting number of set bits?


#1

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…


#2

count_ones is your friend :slight_smile:


#3

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


#4

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!