From 506fc7f9d4fc710fcfae1ec7e5c37824a35f20cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linas=20Vep=C5=A1tas?= Date: Thu, 25 Apr 2024 23:07:13 -0500 Subject: [PATCH] Add a feedback version of the hash function --- link-grammar/connectors.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/link-grammar/connectors.h b/link-grammar/connectors.h index b6c4bc5bf..5b4884032 100644 --- a/link-grammar/connectors.h +++ b/link-grammar/connectors.h @@ -342,7 +342,11 @@ static inline connector_hash_t connector_list_hash(const Connector *c) connector_hash_t accum = connector_hash(c); for (c = c->next; c != NULL; c = c->next) +#ifdef FEEDBACK_HASH + accum = (19 * accum) + (accum >> 24) + connector_hash(c); +#else accum = (19 * accum) + connector_hash(c); +#endif return accum; }