RangeSet bugfixes.

This commit is contained in:
JoelKatz
2013-07-04 00:25:38 -07:00
parent 4a5d3a0f09
commit ce3e6db181

View File

@@ -159,15 +159,10 @@ void RangeSet::clearValue (uint32 v)
if (it->second == v)
{
mRanges.erase (it);
checkInternalConsistency ();
}
else
{
mRanges[v + 1] = it->second;
it->second = v - 1;
checkInternalConsistency ();
++ (it->first);
}
}
else if (it->second == v)
@@ -179,10 +174,9 @@ void RangeSet::clearValue (uint32 v)
uint32 oldEnd = it->second;
it->second = v - 1;
mRanges[v + 1] = oldEnd;
checkInternalConsistency ();
}
checkInternalConsistency();
return;
}
}
@@ -213,22 +207,21 @@ void RangeSet::simplify ()
{
iterator it = mRanges.begin ();
checkInternalConsistency ();
while (1)
{
iterator nit = it;
if (++nit == mRanges.end ())
{
checkInternalConsistency();
return;
}
if (it->second >= (nit->first - 1))
{
// ranges overlap
it->second = nit->second;
mRanges.erase (nit);
checkInternalConsistency ();
}
else
{