You're viewing a comment by cyanide and its responses.

cyanide Permalink
January 18, 2017, 00:19

About counting 1-bits. The artical shows how to clear rightmost 1-bit. This way you do a loop untill you get zero:
int count = 0; while(x!-=0) {count++; x&=x-1;}

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "apple_143": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.