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

Brian Paul brianp at vmware.com
Thu Jan 12 06:29:01 PST 2012


On 01/11/2012 08:59 PM, Alexander von Gluck wrote:
> 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!

Great, I'll push it soon.


> Think this is a candidate for the 8.0 branch?

Probably, but let's wait a day or two to make sure there's no other 
issues on other platforms.

-Brian




More information about the mesa-dev mailing list