[Mesa-dev] [PATCH] mesa: remove _mesa_ffs(), implement ffs() for non-GNU platforms

Alexander von Gluck kallisti5 at unixzen.com
Wed Jan 11 19:59:06 PST 2012


On 11.01.2012 21:11, Brian Paul wrote:
> On 01/11/2012 08:06 PM, Alexander von Gluck wrote:
>> On 11.01.2012 14:50, Brian Paul wrote:
>>> Call ffs() and ffsll() everywhere. Define our own ffs(), ffsll()
>>> functions when the platform doesn't have them.
>>> ---
>>> src/mesa/main/imports.c | 11 ++++++-----
>>
>>> diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
>>> index 2469e42..b3d56db 100644
>>> --- a/src/mesa/main/imports.c
>>> +++ b/src/mesa/main/imports.c
>>> @@ -458,7 +458,7 @@ _mesa_inv_sqrtf(float n)
>>> * Find the first bit set in a word.
>>> */
>>> int
>>> -_mesa_ffs(int32_t i)
>>> +ffs(int i)
>>> {
>>> #if (defined(_WIN32) ) || defined(__IBMC__) || defined(__IBMCPP__)
>>
>> This seems like a bad idea... infinite recursion.
>> ffs calls itself if it's non-gnuc and !WIN && !IBM.
>
> That was an oversight and not intentional.
>
>
>> This is why I changed everything to call _mesa_ffs.
>> Otherwise it does seem to work ok under Haiku as we don't fall into
>> that trap.
>
> I'll post a v2 of the patch.  Would you mind testing again?

Latest code works 100%.  Thanks!

  Think this is a candidate for the 8.0 branch?



More information about the mesa-dev mailing list