Reduce deep nesting some more

This commit is contained in:
Rangi42
2025-07-19 13:44:58 -04:00
parent 7086b8aeff
commit bf69043a1d
6 changed files with 167 additions and 174 deletions

View File

@@ -41,10 +41,8 @@ struct Charmap {
auto [nodeIdx, mapping] = std::move(prefixes.top());
prefixes.pop();
CharmapNode const &node = nodes[nodeIdx];
if (node.isTerminal()) {
if (!callback(nodeIdx, mapping)) {
return false;
}
if (node.isTerminal() && !callback(nodeIdx, mapping)) {
return false;
}
for (unsigned c = 0; c < std::size(node.next); c++) {
if (size_t nextIdx = node.next[c]; nextIdx) {