From 82cfb949637389da32876189f244bc9498d8bdf7 Mon Sep 17 00:00:00 2001 From: ampli Date: Mon, 15 Apr 2024 23:18:02 +0300 Subject: [PATCH] eliminate_duplicate_disjuncts(): Use connector_list_hash() --- link-grammar/disjunct-utils.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/link-grammar/disjunct-utils.c b/link-grammar/disjunct-utils.c index f794448d2..98b629c05 100644 --- a/link-grammar/disjunct-utils.c +++ b/link-grammar/disjunct-utils.c @@ -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));