mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
([Heap -heapifyFromIndex:]): Swap -compare: receiver and argument, so
firstObject is minimum instead of maximum object. ([Heap -addObject:]): Likewise. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1371 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ffdfa979d3
commit
9589470e76
1 changed files with 3 additions and 3 deletions
|
@ -42,12 +42,12 @@
|
|||
right = HEAP_RIGHT(index);
|
||||
left = HEAP_LEFT(index);
|
||||
if (left <= _count
|
||||
&& [_contents_array[left] compare: _contents_array[index]] > 0)
|
||||
&& [_contents_array[index] compare: _contents_array[left]] > 0)
|
||||
largest = left;
|
||||
else
|
||||
largest = index;
|
||||
if (right <= _count
|
||||
&& [_contents_array[right] compare: _contents_array[largest]] > 0)
|
||||
&& [_contents_array[largest] compare: _contents_array[right]] > 0)
|
||||
largest = right;
|
||||
if (largest != index)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@
|
|||
[newObject retain];
|
||||
for (i = _count-1;
|
||||
i > 0
|
||||
&& [_contents_array[HEAP_PARENT(i)] compare: newObject] < 0;
|
||||
&& [newObject compare: _contents_array[HEAP_PARENT(i)]] < 0;
|
||||
i = HEAP_PARENT(i))
|
||||
{
|
||||
_contents_array[i] = _contents_array[HEAP_PARENT(i)];
|
||||
|
|
Loading…
Reference in a new issue