I'm having some trouble getting a matching entry in my
hash table. It looks like the problem is here:
/* Locates an entry matching TARGET. Returns the index for the
entry, if found, or the index of an empty entry that indicates
where TARGET should go, otherwise. */
static inline unsigned
locate_matching_entry (struct hsh_table *h, const void *target)
{
unsigned i = h->hash (target, h->aux);
assert (h->hash_ordered);
for (;;)
{
void *entry;
i &= h->size - 1;
entry = h->entries[i];
if (entry == NULL || !h->compare (entry, target, h->aux))
return i;
i--;
}
}
In my code, h->compare (entry, target, h->aux) returns 1 when
entry and target match. So I would think locate_matching_entry()
should return i, but it doesn't because of the !h->compare (...).
Should this line be:
if (entry == NULL || h->compare (entry, target, h->aux))
??
-Jason
_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev