[Mesa-dev] [PATCH 2/2] mesa: Use the new hash table for the variable refcount visitor.

Jordan Justen jljusten at gmail.com
Tue Dec 4 14:29:01 PST 2012


On Tue, Dec 4, 2012 at 10:41 AM, Eric Anholt <eric at anholt.net> wrote:
> Ian Romanick <idr at freedesktop.org> writes:
>> On 12/03/2012 02:52 PM, Jordan Justen wrote:
>>> +static bool
>>> +pointer_key_compare(const void *a, const void *b)
>>> +{
>>> +   return a == b;
>>> +}
>>> +
>>> +/* We could do better. */
>>> +static uint32_t
>>> +pointer_hash(void *a)
>>> +{
>>> +   return (uintptr_t)a;
>>
>> Perhaps...
>>
>>       return (uintptr_t) a / sizeof(ir_variable);
>>
>> Or at least shift of the low couple bits.  Otherwise we know a lot of
>> bins will be empty, right?  (Or is this not that kind of hash table?)
>
> It's prime-sized.

Should I just use _mesa_key_pointer_equal and _mesa_hash_pointer?

-Jordan


More information about the mesa-dev mailing list