- state_mark_reachable_states (states[0]);
- for (state_number i = 0; i < nstates; ++i)
- {
- if (states[i]->reachable)
- {
- states[nstates_reachable] = states[i];
- states[nstates_reachable]->number = nstates_reachable;
- old_to_new[i] = nstates_reachable++;
- }
- else
- {
- state_free (states[i]);
- old_to_new[i] = nstates;
- }
- }
+ bitset reachable = bitset_create (nstates, BITSET_FIXED);
+ state_record_reachable_states (states[0], reachable);
+ {
+ state_number i;
+ for (i = 0; i < nstates; ++i)
+ {
+ if (bitset_test (reachable, states[i]->number))
+ {
+ states[nstates_reachable] = states[i];
+ states[nstates_reachable]->number = nstates_reachable;
+ old_to_new[i] = nstates_reachable++;
+ }
+ else
+ {
+ state_free (states[i]);
+ old_to_new[i] = nstates;
+ }
+ }
+ }