* src/closure.c (closure): Instead of looping over word in array

then bits in words, loop over bits in array.
This commit is contained in:
Akim Demaille
2001-11-28 14:53:03 +00:00
parent 2c4c30aa95
commit d2b04478d4
2 changed files with 18 additions and 16 deletions

View File

@@ -1,3 +1,9 @@
2001-11-28 Akim Demaille <akim@epita.fr>
* 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 <akim@epita.fr>
* src/closure.c (closure): No longer optimize the special case

View File

@@ -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)