[Mesa-dev] [PATCH 5/6] gallium/util: Add an implementation of ffsl

Jason Ekstrand jason at jlekstrand.net
Mon Sep 14 11:49:02 PDT 2015


On Mon, Sep 14, 2015 at 11:41 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On Saturday, August 15, 2015 11:31:26 AM Jason Ekstrand wrote:
>> ---
>>  src/gallium/auxiliary/util/u_math.h | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
>> index 56bd185..5814421 100644
>> --- a/src/gallium/auxiliary/util/u_math.h
>> +++ b/src/gallium/auxiliary/util/u_math.h
>> @@ -391,6 +391,18 @@ unsigned ffs( unsigned u )
>>
>>  #endif /* FFS_DEFINED */
>>
>> +#ifndef FFSL_DEFINED
>> +#define FFSL_DEFINED 1
>> +
>> +#ifdef _MSC_VER
>> +/* With MSVC, int and long are the same type even on 64-bit */
>> +#define ffsl ffs
>> +#else
>> +#define ffsl(x) ((sizeof(long) == sizeof(int)) ? ffs(x) : ffsll(x))
>> +#endif
>> +
>> +#endif /* FFSL_DEFINED */
>> +
>>  /**
>>   * Find first bit set in long long.  Least significant bit is 1.
>>   * Return 0 if no bits set.
>>
>
> I noticed this patch never landed; Marek reviewed it.
>
> Still worth pushing?

Maybe.  However, it has no users since the one user of it was my
attempt to use 64-bit words for bitsets which turned out to tank
performance.
--Jason


More information about the mesa-dev mailing list