Skip to content
Snippets Groups Projects
Commit f2dfda6a authored by Wei, Elson's avatar Wei, Elson
Browse files

ancestor.deepest: decrement ninteresting correctly (issue3984)

The invariant this code tries to hold is that ninteresting is the number of
non-zero elements in the interesting array. interesting[nsp] is incremented at
the same time as interesting[sp] is decremented. So if interesting[nsp] was
previously 0, ninteresting shouldn't be decremented.
parent 8704477a
No related branches found
No related tags found
No related merge requests found
......@@ -1362,4 +1362,7 @@
if (nsp == sp)
continue;
seen[p] = nsp;
interesting[sp] -= 1;
if (interesting[sp] == 0 && interesting[nsp] > 0)
ninteresting -= 1;
interesting[nsp] += 1;
......@@ -1365,7 +1368,4 @@
interesting[nsp] += 1;
interesting[sp] -= 1;
if (interesting[sp] == 0)
ninteresting -= 1;
}
}
interesting[sv] -= 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment