Skip to content

Instantly share code, notes, and snippets.

View int32bit's full-sized avatar
🌴
On vacation

int32bit int32bit

🌴
On vacation
View GitHub Profile
@int32bit
int32bit / count_one.c
Created November 18, 2015 15:51
A magic method for calculating the number of binary 1
int solve(int n)
{
int sum = 0;
while (n) {
++sum;
n &= (n - 1);
}
return sum;
}
@int32bit
int32bit / test.c
Created November 18, 2015 15:48
HelloWorld
#include <stdio.h>
int main(int argc, char **argv)
{
printf("HelloWorld!\n");
return 0;
}