From d2b04478d43aafc69426af73667ec017949ea2c5 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 28 Nov 2001 14:53:03 +0000 Subject: [PATCH 1/1] * src/closure.c (closure): Instead of looping over word in array then bits in words, loop over bits in array. --- ChangeLog | 6 ++++++ src/closure.c | 28 ++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4cf7406..944950d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +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 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) -- 2.45.2