Re: [AD] Allegro 5 new config routines, alpha 1

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Forgor one more thing about hash tables.  AFAIK, it is recommended to
make size of hash table a prime number and use (code % SIZE) to
constrain hash code to size of hash table.

Would not it be better to make hash table an array of pointers to
structs, not array of structs themselves.  Then it would not matter
whether you make table large or small, because it would not waste
memory that much.  It would be more straightforward to search for hash
entry you need

for (node = hash[code]; node != 0; node = node->next)
  ...

-- 
Michael Bukin



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/