Skip to content

Instantly share code, notes, and snippets.

View pbassut's full-sized avatar

Patrick Bassut pbassut

View GitHub Profile
### Keybase proof
I hereby claim:
* I am pbassut on github.
* I am pbassut (https://keybase.io/pbassut) on keybase.
* I have a public key whose fingerprint is B80D EAD9 EFA7 D712 3A64 D255 4FAE A701 18DC EF18
To claim this, I am signing this object:
#include <stdio.h>
#include <stdint.h>
uint32_t NumberOfSetBits(uint32_t i)
{
return (((((i - ((i >> 1) & 0x55555555)) & 0x33333333) + (((i - ((i >> 1) & 0x55555555)) >> 2) & 0x33333333) + (((i - ((i >> 1) & 0x55555555)) & 0x33333333) + (((i - ((i >> 1) & 0x55555555)) >> 2) & 0x33333333) >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
int main(){
printf("%d", NumberOfSetBits(127));