mirror of
https://github.com/Z3Prover/z3
synced 2025-04-16 05:48:44 +00:00
This reverts commit cf4d0e74a5
.
This commit is contained in:
parent
80ac7b3438
commit
5003d41cdb
|
@ -155,23 +155,15 @@ public:
|
||||||
elem->init(elem);
|
elem->init(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool invariant() const {
|
bool invariant() const {
|
||||||
auto* e = this;
|
auto* e = this;
|
||||||
const T* slow = static_cast<const T*>(this);
|
do {
|
||||||
const T* fast = m_next;
|
if (e->m_next->m_prev != e)
|
||||||
bool looped = false;
|
return false;
|
||||||
// m_next of each node should point back to m_prev of the following node,
|
e = e->m_next;
|
||||||
// and m_prev of each node should point forward to m_next of the preceding node.
|
}
|
||||||
while (slow != fast) {
|
while (e != this);
|
||||||
if (fast->m_prev->m_next != fast || fast->m_next->m_prev != fast)
|
return true;
|
||||||
return false;
|
|
||||||
fast = fast->m_next;
|
|
||||||
looped = looped || (fast == static_cast<const T*>(this));
|
|
||||||
if (!looped && fast == m_next)
|
|
||||||
// We should be able to traverse back to the starting node.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool contains(T const* list, T const* elem) {
|
static bool contains(T const* list, T const* elem) {
|
||||||
|
|
Loading…
Reference in a new issue