Re: Yet more ARM breakage in linux-next

From: Rusty Russell
Date: Mon Dec 08 2008 - 01:20:51 EST


On Monday 08 December 2008 08:20:59 Geert Uytterhoeven wrote:
> On Fri, 5 Dec 2008, Rusty Russell wrote:
> > +static inline int __fls(int x)
> ^^^ ^^^
> Other implementations take `unsigned long' and return `unsigned long'...

It's all over the place, actually. 32 bit archs are especially loose.

I've been toying with the idea of a boottime testsuite for all the
bitops to see who gets them wrong.

> > +static inline int __fls(unsigned long word)
> ^^^ ^^^^^^^^^^^^^
> > +{
> > + return fls(word) - 1;
> > +}
> > +
>
> ... but this one uses mixed types?

I cut and pasted. I thought you were 32 bit, so doesn't matter?

> What are the official semantics of __fls()?

Find last bit set in the word, undefined if word is 0. Returns 0
to BITS_PER_LONG-1.

Cheers,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/