Really fix prevMissing

This commit is contained in:
Vinnie Falco
2013-07-04 13:48:23 -07:00
parent 026514157d
commit 5dcbc92259

View File

@@ -85,6 +85,10 @@ uint32 RangeSet::prevMissing (uint32 v) const
{ {
checkInternalConsistency (); checkInternalConsistency ();
// Handle the case where the loop reaches the terminating condition
//
result = v - 1;
for (const_reverse_iterator cur = mRanges.rbegin (); cur != mRanges.rend (); ++cur) for (const_reverse_iterator cur = mRanges.rbegin (); cur != mRanges.rend (); ++cur)
{ {
// See if v is in the range // See if v is in the range
@@ -116,8 +120,6 @@ uint32 RangeSet::prevMissing (uint32 v) const
break; break;
} }
} }
result = v - 1;
} }
bassert (result == absent || !hasValue (result)); bassert (result == absent || !hasValue (result));