Re: [PATCH] Introduce a boolean "single_bit_set" function.

H. Peter Anvin
2009-06-29T18:51:12Z

Petr Tesarik wrote:
>
> Ok, then my only concern is that the hweight* functions return the exact
> weight, which might be much less efficient if all we need is to know
> whether it's 1.
>
> Theoretically, gcc should be able to optimize things out, but I'm not
> all that optimistic about how well it does it.
>

I can almost guarantee it won't in this case.

-hpa