undefined reference to `__ffs'

Nicolas Pitre nico at cam.org
Mon Aug 30 16:03:21 EDT 2004


On Mon, 30 Aug 2004, Josh Boyer wrote:

> On Mon, 2004-08-30 at 13:53, Nicolas Pitre wrote:
>> On Mon, 30 Aug 2004, Josh Boyer wrote:
>>
>>> On Mon, 2004-08-30 at 13:20, Brian T wrote:
>>>> Not sure how to fix it for non-x86 then.  Point me in the right direction?
>>>
>>> Welcome to the hell that is compatmac.h ;).
>>>
>>> Seriously though, maybe take a look at generic_ffs() in
>>> include/linux/bitops.h (in the 2.6 kernel).
>>
>> Again, ffs()/generic_ffs() are not equivalent to __ffs().
>
> Hm, I remember you saying that now.  Care to explain how they are
> different?

Guys, you really should look at the source...

linux-2.6.8/include/asm-i386/bitops.h:

/**
  * __ffs - find first bit in word.
  * @word: The word to search
  *
  * Undefined if no bit exists, so code should check against 0 first.
  */

[...]

/**
  * ffz - find first zero in word.
  * @word: The word to search
  *
  * Undefined if no zero exists, so code should check against ~0UL first.
  */

[...]

/**
  * ffs - find first bit set
  * @x: the word to search
  *
  * This is defined the same way as
  * the libc and compiler builtin ffs routines, therefore
  * differs in spirit from the above ffz (man ffs).
  */

In short, one starts at 0 while the other one starts at 1.


Nicolas




More information about the linux-mtd mailing list