tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Exporting ffs32/ffs64

On Mon, Aug 03, 2009 at 08:42:26PM +0100, David Laight wrote:
> On Mon, Aug 03, 2009 at 03:53:43PM +0100, Mindaugas Rasiukevicius wrote:
> > Hello,
> > 
> > Joerg Sonnenberger <> wrote:
> > > I am going to add support for ffsl and ffsll soon. One practical
> > > question is whether we want to provide the fixed width versions (ffs32
> > > and ffs64) in libc namespace or not. They can currently be obtained as
> > > inline functions from sys/bitops.h and I don't see a strong reason to
> > > not provide them.
> Presumably most of the definitions are 'weak' ?

Do we gain something from making them weak? I would have used strong

> What about ffsimax?

Would be fine, haven't seen a reason for that yet.

> My thought it that, for architectures that have a fast ffs instruction, these
> should be asm inlines. With the functions only being needed to their
> address can be taken.

I am fine with that too, but would suggest to make that a second step.

> Given that code almost always needs to have a test for 'no bits set',
> this can equally well be placed before the ffs() call, so an inline
> ffs_nz() which returns 0..31 and an indeterminate value for 0 would
> be useful - particulatly if trying to write some fast algorithm in C.

I'm not sure if that is actually done. It more looks like a lot of code
does the check afterwards.


Home | Main Index | Thread Index | Old Index