kernel/util: Fix MinMaxHeap::_GrowHeap()
This commit is contained in:
parent
7e1ecb9315
commit
ed8627e535
@ -335,8 +335,8 @@ MIN_MAX_HEAP_CLASS_NAME::_GrowHeap(int minimalSize)
|
|||||||
fMinElements = newBuffer;
|
fMinElements = newBuffer;
|
||||||
|
|
||||||
newBuffer += newSize / 2;
|
newBuffer += newSize / 2;
|
||||||
if (fMaxElements != NULL)
|
if (fMaxLastElement > 0)
|
||||||
memcpy(newBuffer, fMaxElements, fSize * sizeof(Element*));
|
memcpy(newBuffer, fMinElements + fSize, fSize * sizeof(Element*));
|
||||||
fMaxElements = newBuffer;
|
fMaxElements = newBuffer;
|
||||||
|
|
||||||
fSize = newSize / 2;
|
fSize = newSize / 2;
|
||||||
@ -426,7 +426,7 @@ MIN_MAX_HEAP_CLASS_NAME::_ChangeTree(MinMaxHeapLink<Element, Key>* link)
|
|||||||
|
|
||||||
if (otherLastElement <= 0) {
|
if (otherLastElement <= 0) {
|
||||||
ASSERT(currentLastElement == 1);
|
ASSERT(currentLastElement == 1);
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT((link->fIndex - 1) / 2 < otherLastElement);
|
ASSERT((link->fIndex - 1) / 2 < otherLastElement);
|
||||||
|
Loading…
Reference in New Issue
Block a user