From: Akim Demaille Date: Wed, 28 Nov 2001 14:57:16 +0000 (+0000) Subject: * src/closure.c (closure): Instead of looping over word in array X-Git-Tag: BISON-1_30f~58 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/e1828f4f0782be49ed56a6609c6db843a32ab8f1?ds=sidebyside * src/closure.c (closure): Instead of looping over word in array then bits in words, loop over bits in array. --- diff --git a/ChangeLog b/ChangeLog index 291d7893..b89a11cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,14 @@ +2001-11-28 Akim Demaille + + * src/closure.c (closure): Instead of looping over word in array + then bits in words, loop over bits in array. + 2001-11-28 Akim Demaille * src/closure.c (closure): No longer optimize the special case where all the bits of `ruleset[r]' are set to 0, to make the code clearer. - 2001-11-28 Akim Demaille * src/closure.c (closure): `r' and `c' are new variables, used to diff --git a/src/closure.c b/src/closure.c index ad3a5be7..874bbbd5 100644 --- a/src/closure.c +++ b/src/closure.c @@ -242,7 +242,8 @@ closure (short *core, int n) /* Index over RULESET. */ int r; - int itemno; + /* A bit index over RULESET. */ + int b; if (trace_flag) { @@ -271,27 +272,22 @@ closure (short *core, int n) ruleno = 0; itemsetsize = 0; c = 0; - for (r = 0; r < rulesetsize; ++r) + for (b = 0; b < rulesetsize * BITS_PER_WORD; ++b) { - int b; - - for (b = 0; b < BITS_PER_WORD; b++) + if (BITISSET (ruleset, b)) { - if (ruleset[r] & (1 << b)) + int itemno = rule_table[ruleno].rhs; + while (c < n && core[c] < itemno) { - itemno = rule_table[ruleno].rhs; - while (c < n && core[c] < itemno) - { - itemset[itemsetsize] = core[c]; - itemsetsize++; - c++; - } - itemset[itemsetsize] = itemno; + itemset[itemsetsize] = core[c]; itemsetsize++; + c++; } - - ruleno++; + itemset[itemsetsize] = itemno; + itemsetsize++; } + + ruleno++; } while (c < n)