Re:Counting set bits in an interesting way
by tikhonj on Sunday May 01, 2022 @01:32AM
(#31222467)
The point is that writing "__builtin_popcount" makes your intentions clearer than implementing popcount as a loop. The guaranteed performance is downstream of the clarity: since the code is more explicit, the compiler doesn't have to rely on heuristics to guess that you want popcount, so it will always do the right thing.
[ Parent
| on HN ]
There are no comments on this comment yet.