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 03:53:43PM +0100, Mindaugas Rasiukevicius wrote:
> Hello,
>
> Joerg Sonnenberger <joerg%britannica.bec.de@localhost> 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' ?
> Exporting fixed width versions (ffs32 and ffs64) sound reasonable. Would all
> architectures support 64-bit version?
>
> Why do you want to export ffsl and ffsll?
Because you have a variable of type 'long' or 'long long' !
What about ffsimax?
Actually the argument to ffs() can be safely promoted to a larger
integral type.
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.
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.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index