mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 02:33:03 +00:00
style: reduce: introduce and use a swap for bitset
* src/reduce.c (bitset_swap): New. Use it.
This commit is contained in:
19
src/reduce.c
19
src/reduce.c
@@ -57,6 +57,13 @@ rule_number nuseless_productions;
|
|||||||
static int nuseful_nonterminals;
|
static int nuseful_nonterminals;
|
||||||
symbol_number nuseless_nonterminals;
|
symbol_number nuseless_nonterminals;
|
||||||
|
|
||||||
|
#define bitset_swap(Lhs, Rhs) \
|
||||||
|
do { \
|
||||||
|
bitset lhs__ = Lhs; \
|
||||||
|
Lhs = Rhs; \
|
||||||
|
Rhs = lhs__; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/*-------------------------------------------------------------------.
|
/*-------------------------------------------------------------------.
|
||||||
| Another way to do this would be with a set for each production and |
|
| Another way to do this would be with a set for each production and |
|
||||||
| then do subset tests against N0, but even for the C grammar the |
|
| then do subset tests against N0, but even for the C grammar the |
|
||||||
@@ -119,11 +126,7 @@ useless_nonterminals (void)
|
|||||||
}
|
}
|
||||||
if (bitset_equal_p (N, Np))
|
if (bitset_equal_p (N, Np))
|
||||||
break;
|
break;
|
||||||
{
|
bitset_swap (N, Np);
|
||||||
bitset Ns = Np;
|
|
||||||
Np = N;
|
|
||||||
N = Ns;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bitset_free (N);
|
bitset_free (N);
|
||||||
N = Np;
|
N = Np;
|
||||||
@@ -181,11 +184,7 @@ inaccessable_symbols (void)
|
|||||||
}
|
}
|
||||||
if (bitset_equal_p (V, Vp))
|
if (bitset_equal_p (V, Vp))
|
||||||
break;
|
break;
|
||||||
{
|
bitset_swap (V, Vp);
|
||||||
bitset Vs = Vp;
|
|
||||||
Vp = V;
|
|
||||||
V = Vs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user