Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

int32bit int32bit

🌴
On vacation
Block or report user

Report or block int32bit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@int32bit
int32bit / count_one.c
Created Nov 18, 2015
A magic method for calculating the number of binary 1
View count_one.c
int solve(int n)
{
int sum = 0;
while (n) {
++sum;
n &= (n - 1);
}
return sum;
}
View test.c
#include <stdio.h>
int main(int argc, char **argv)
{
printf("HelloWorld!\n");
return 0;
}
You can’t perform that action at this time.