| 207 | |
| 208 | template<class Tracer> |
| 209 | forceinline void |
| 210 | Path<Tracer>::unwind(int l, Tracer& t) { |
| 211 | assert((ds[l].space() == nullptr) || ds[l].space()->failed()); |
| 212 | int n = ds.entries(); |
| 213 | if (t) { |
| 214 | for (int i=l; i<n; i++) { |
| 215 | Path<Tracer>::Edge& top = ds.top(); |
| 216 | unsigned int fa = (i != l) ? top.alt() + 1 : top.alt(); |
| 217 | for (unsigned int a = fa; a < top.choice()->alternatives(); a++) { |
| 218 | SearchTracer::EdgeInfo ei(t.wid(), top.nid(), a); |
| 219 | t.skip(ei); |
| 220 | } |
| 221 | if (ds.top().work()) |
| 222 | n_work--; |
| 223 | ds.pop().dispose(); |
| 224 | } |
| 225 | } else { |
| 226 | for (int i=l; i<n; i++) { |
| 227 | if (ds.top().work()) |
| 228 | n_work--; |
| 229 | ds.pop().dispose(); |
| 230 | } |
| 231 | } |
| 232 | assert(ds.entries() == l); |
| 233 | } |
| 234 | |
| 235 | template<class Tracer> |
| 236 | forceinline void |