mirror of
https://github.com/Z3Prover/z3
synced 2025-04-08 18:31:49 +00:00
fix(union-find): keep values and representative in consistent order
the merge handlers should be called with r1,r2,v1,v2 or r2,r1,v2,v1 but not a mix
This commit is contained in:
parent
12f9336fec
commit
5141f05e6d
|
@ -122,8 +122,10 @@ public:
|
|||
TRACE("union_find", tout << "merging " << r1 << " " << r2 << "\n";);
|
||||
if (r1 == r2)
|
||||
return;
|
||||
if (m_size[r1] > m_size[r2])
|
||||
if (m_size[r1] > m_size[r2]) {
|
||||
std::swap(r1, r2);
|
||||
std::swap(v1, v2);
|
||||
}
|
||||
m_ctx.merge_eh(r2, r1, v2, v1);
|
||||
m_find[r1] = r2;
|
||||
m_size[r2] += m_size[r1];
|
||||
|
|
Loading…
Reference in a new issue