Use bitset operations when possible, not loops over bits.

* src/conflicts.c (set_conflicts, count_sr_conflicts): Use
bitset_or.
* src/print.c (print_reductions): Use bitset_and, bitset_andn.
* src/reduce.c (useless_nonterminals): Formatting changes.
* src/warshall.c (TC): Use bitset_or.
This commit is contained in:
Akim Demaille
2002-03-04 12:05:30 +00:00
parent 0e721e7569
commit f9abaa2c4c
5 changed files with 53 additions and 63 deletions

View File

@@ -126,16 +126,12 @@ useless_nonterminals (void)
{
bitset_copy (Np, N);
for (i = 1; i <= nrules; i++)
{
if (!bitset_test (P, i))
{
if (useful_production (i, N))
{
bitset_set (Np, rules[i].lhs - ntokens);
bitset_set (P, i);
}
}
}
if (!bitset_test (P, i)
&& useful_production (i, N))
{
bitset_set (Np, rules[i].lhs - ntokens);
bitset_set (P, i);
}
if (bitset_equal_p (N, Np))
break;
Ns = Np;