[PATCH] Add ffs() to libiberty
DJ Delorie
dj@redhat.com
Sat Jul 14 17:00:00 GMT 2001
> In the _subsequent_ tests. The (valu & 0xCC) and (valu & 0xAA)
> tests aren't valid unless there is exactly one bit set.
Doh, you're right.
> On the contrary, it's well defined.
Still, I'd rather see something like this:
valu = valu & ~(valu - 1);
than see negation of an unsigned value (yes, I know they *do* exactly
the same thing, but they *mean* different things).
We probably should put a comment on that line too, like "Make sure
there is exactly one bit set."
More information about the Gcc-patches
mailing list