From: John Darrington Date: Wed, 5 Oct 2011 13:52:18 +0000 (+0200) Subject: Added a base parameter to the interaction_case_hash function X-Git-Tag: v0.7.9~130 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc29c57e7908b0bdc6ab84f8aa4b7cb8a780026c;p=pspp-builds.git Added a base parameter to the interaction_case_hash function --- diff --git a/src/math/categoricals.c b/src/math/categoricals.c index 9f8215d3..81c673b3 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -279,7 +279,7 @@ static struct interaction_value * lookup_case (const struct hmap *map, const struct interaction *iact, const struct ccase *c) { struct interaction_value *iv = NULL; - size_t hash = interaction_case_hash (iact, c); + size_t hash = interaction_case_hash (iact, c, 0); HMAP_FOR_EACH_WITH_HASH (iv, struct interaction_value, node, hash, map) { @@ -375,7 +375,6 @@ categoricals_update (struct categoricals *cat, const struct ccase *c) } } - for (i = 0 ; i < cat->n_iap; ++i) { const struct interaction *iact = cat->iap[i].iact; @@ -383,7 +382,7 @@ categoricals_update (struct categoricals *cat, const struct ccase *c) // if ( interaction_case_is_missing (iact, c, cat->exclude)) // continue; - size_t hash = interaction_case_hash (iact, c); + size_t hash = interaction_case_hash (iact, c, 0); struct interaction_value *node = lookup_case (&cat->iap[i].ivmap, iact, c); if ( NULL == node) diff --git a/src/math/interaction.c b/src/math/interaction.c index 746cc17f..269aa7e9 100644 --- a/src/math/interaction.c +++ b/src/math/interaction.c @@ -155,10 +155,10 @@ interaction_to_string (const struct interaction *iact, struct string *str) } unsigned int -interaction_case_hash (const struct interaction *iact, const struct ccase *c) +interaction_case_hash (const struct interaction *iact, const struct ccase *c, unsigned int base) { int i; - size_t hash = 0; + size_t hash = base; for (i = 0; i < iact->n_vars; ++i) { const struct variable *var = iact->vars[i]; diff --git a/src/math/interaction.h b/src/math/interaction.h index 0fb1f262..ccd6706f 100644 --- a/src/math/interaction.h +++ b/src/math/interaction.h @@ -42,7 +42,7 @@ bool interaction_is_subset (const struct interaction *x, const struct interactio struct ccase; -unsigned int interaction_case_hash (const struct interaction *, const struct ccase *); +unsigned int interaction_case_hash (const struct interaction *, const struct ccase *, unsigned int base); bool interaction_case_equal (const struct interaction *, const struct ccase *, const struct ccase *); bool interaction_case_is_missing (const struct interaction *, const struct ccase *, enum mv_class); int interaction_case_cmp_3way (const struct interaction *, const struct ccase *, const struct ccase *);