bloemen: avoid tail-recursive calls

* spot/mc/bloemen.hh: here.
This commit is contained in:
Etienne Renault 2018-03-28 16:31:05 +02:00
parent ae101a509f
commit 73ccf2216d

View file

@ -161,15 +161,16 @@ namespace spot
bool sameset(uf_element* a, uf_element* b) bool sameset(uf_element* a, uf_element* b)
{ {
uf_element* a_root = find(a); while (true)
uf_element* b_root = find(b); {
if (a_root == b_root) uf_element* a_root = find(a);
return true; uf_element* b_root = find(b);
if (a_root == b_root)
return true;
if (a_root->parent.load() == a_root) if (a_root->parent.load() == a_root)
return false; return false;
}
return sameset(a_root, b_root);
} }
bool lock_root(uf_element* a) bool lock_root(uf_element* a)