bloemen: avoid tail-recursive calls
* spot/mc/bloemen.hh: here.
This commit is contained in:
parent
ae101a509f
commit
73ccf2216d
1 changed files with 9 additions and 8 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue