Skip to content
Snippets Groups Projects
Commit 2409857d authored by Russel Arbore's avatar Russel Arbore
Browse files

fix least_common_ancestor

parent dbc6216c
No related branches found
No related tags found
No related merge requests found
......@@ -82,10 +82,10 @@ impl DomTree {
* ancestor of the two nodes that is as far down the tree as possible.
*/
pub fn least_common_ancestor(&self, mut a: NodeID, mut b: NodeID) -> NodeID {
while self.idom[&a].0 < self.idom[&b].0 {
while self.idom[&a].0 > self.idom[&b].0 {
a = self.idom[&a].1;
}
while self.idom[&a].0 > self.idom[&b].0 {
while self.idom[&a].0 < self.idom[&b].0 {
b = self.idom[&b].1;
}
while a != b {
......
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