Ian Romanick <[email protected]> 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.
>> static bool debug = false;
>>
>> @@ -49,8 +50,11 @@ do_dead_code(exec_list *instructions, bool
>> uniform_locations_assigned)
>>
>> v.run(instructions);
>>
>> - foreach_iter(exec_list_iterator, iter, v.variable_list) {
>> - ir_variable_refcount_entry *entry = (ir_variable_refcount_entry
>> *)iter.get();
>> + struct hash_entry *e;
>> + for (e = _mesa_hash_table_next_entry(v.ht, NULL);
>> + e != NULL;
>> + e = _mesa_hash_table_next_entry(v.ht, e)) {
>> + ir_variable_refcount_entry *entry = (ir_variable_refcount_entry
>> *)e->data;
This should use the foreach macro.
pgpMjIHWu41HD.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
