Skip to content

Commit

Permalink
eliminate_duplicate_disjuncts(): Use connector_list_hash()
Browse files Browse the repository at this point in the history
  • Loading branch information
ampli committed Apr 15, 2024
1 parent 79a694a commit 82cfb94
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions link-grammar/disjunct-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,15 @@ struct disjunct_dup_table_s
static inline unsigned int old_hash_disjunct(disjunct_dup_table *dt,
Disjunct * d, bool string_too)
{
unsigned int i;
i = 0;
for (Connector *e = d->left; e != NULL; e = e->next) {
i = (41 * (i + e->desc->uc_num)) + (unsigned int)e->desc->lc_letters + 7;
}
for (Connector *e = d->right; e != NULL; e = e->next) {
i = (41 * (i + e->desc->uc_num)) + (unsigned int)e->desc->lc_letters + 7;
}
unsigned int i = 0;

if (NULL != d->left)
i = connector_list_hash(d->left);
if (NULL != d->right)
i += 19 * connector_list_hash(d->right);
if (string_too)
i += string_hash(d->word_string);
i += (i>>10);
//i += (i>>10);

d->dup_hash = i;
return (i & (dt->dup_table_size-1));
Expand Down

0 comments on commit 82cfb94

Please sign in to comment.