On 12/12/2014 08:45 PM, Richard Henderson wrote:
Probably doesn't matter much, but
ret = (ctpop8(r1) & 1)
| ((ctpop8(r1 >> 8) & 1) << 8)
| ((ctpop8(r1 >> 16) & 1) << 16)
| ((ctpop8(r1 >> 24) & 1) << 24);
This looks much more compact to me. Thanks!
One could also make a case for adding new helpers that
use __builtin_parity rather than __builtin_popcount.
I usually like to look at things like this and see how
the general infrastructure can be improved...
This is a good idea. I'll send another patch, that adds the infrastructure.
Cheers,
Bastian