C language statistics of the number of "1" in the format of binary numbers (strange skills)

C language statistics of the number of "1" in the format of binary numbers (strange skills)

int v = 99, c = 0;
for (c =0; v; c++) {
    v &= v-1;
}
printf("count: %d\n", c);

Comments

Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example