Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
15bit popcount from Hacker's Delight, p. 72
//Special for 15-bit values on 64bit processors
//with fast multiplication
//From Hacker's Delight, p. 72
inline uint32_t popcount15(uint32_t x)
uint64_t y;
y = x * 0x0002000400080010;
y = y & 0x1111111111111111;
y = y * 0x1111111111111111;
y = y >> 60;
return y;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.