begin
aList^[aFromInx] := aList^[ParentInx];
aFromInx := ParentInx;
ParentInx := (aFromInx - 1) div 2;
end;
{сохранить элемент в той позиции, где был прекращен процесс пузырькового подъема}
aList^[aFromInx] := Item;
end;
procedure HSTrickleDownStd( aList : PPointerList;
aFromInx : integer;
aCount : integer;
aCompare : TtdCompareFunc );
var
Item : pointer;
ChildInx : integer;
begin
Item := aList^[aFromInx];
ChildInx := (aFromInx * 2) + 1;
while (ChildInx < aCount) do
begin
if (succ(ChildInx) < aCount) and
(aCompare(aList^[ChildInx], aList^[succ(ChildInx)]) < 0) then
inc(ChildInx);
if aCompare(Item, aList^[ChildInx]) >= 0 then
Break;
aList^[aFromInx] := aList^[ChildInx];
aFromInx := ChildInx;
ChildInx := (aFromInx * 2) + 1;
end;
aList^[aFromInx] := Item;