12 ms·
Sometimes you might use bits in an integer to encode data, e.g.; - A bitset index - Bitflags (e.g. to represent logging levels) - Feature flags `bit_count`
by clappski 4y ago
Sometimes you might use bits in an integer to encode data, e.g.;
- A bitset index
- Bitflags (e.g. to represent logging levels)
- Feature flags
`bit_count` (aka `popcount`) gives you an efficient way to figure out how many bits within those structures are set and not set.