The naive approach won't fly in your interview for that job you really want. It shows you been nowhere and haven't read beyond the end of your nose.
Courtesy of Claude. Extra points for spotting the BS items:
- Naive Method
- Recursion
- Kernighan’s Algorithm
- Looping Over Only Set Bits
- Table Lookup for Nibbles
- 128-entry Table for Byte Lookup
- Lookup Table
- GCC Built-in Function
- Divide-and-Conquer (Parallel Bit Count / HAKMEM Algorithm)
- SWAR (SIMD Within A Register)
- MIT HAKMEM Popcount
- Kernighan with Loop Unrolling
- AVX / SSE Intrinsics
- Parallel Algorithm with Carry-Save Adders
- Hardware Instruction Access (e.g. POPCNT)
- Recursive Bit Pairing
- Bit Manipulation with Floating Point Hack
a7