mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:49:23 +02:00
* use Inc() and Dec() instead of v:=v+1
git-svn-id: trunk@41178 -
This commit is contained in:
parent
63f9afa6bd
commit
59a75ea429
@ -64,16 +64,16 @@ begin
|
|||||||
P := ItemPtrs[ (L + R) div 2 ];
|
P := ItemPtrs[ (L + R) div 2 ];
|
||||||
repeat
|
repeat
|
||||||
while Comparer(P, ItemPtrs[i]) > 0 do
|
while Comparer(P, ItemPtrs[i]) > 0 do
|
||||||
I := I + 1;
|
Inc(I);
|
||||||
while Comparer(P, ItemPtrs[J]) < 0 do
|
while Comparer(P, ItemPtrs[J]) < 0 do
|
||||||
J := J - 1;
|
Dec(J);
|
||||||
If I <= J then
|
If I <= J then
|
||||||
begin
|
begin
|
||||||
Q := ItemPtrs[I];
|
Q := ItemPtrs[I];
|
||||||
ItemPtrs[I] := ItemPtrs[J];
|
ItemPtrs[I] := ItemPtrs[J];
|
||||||
ItemPtrs[J] := Q;
|
ItemPtrs[J] := Q;
|
||||||
I := I + 1;
|
Inc(I);
|
||||||
J := J - 1;
|
Dec(J);
|
||||||
end;
|
end;
|
||||||
until I > J;
|
until I > J;
|
||||||
// sort the smaller range recursively
|
// sort the smaller range recursively
|
||||||
@ -114,16 +114,16 @@ procedure QuickSort_PtrList_Context(ItemPtrs: PPointer; ItemCount: SizeUInt; Com
|
|||||||
P := ItemPtrs[ (L + R) div 2 ];
|
P := ItemPtrs[ (L + R) div 2 ];
|
||||||
repeat
|
repeat
|
||||||
while Comparer(P, ItemPtrs[I], Context) > 0 do
|
while Comparer(P, ItemPtrs[I], Context) > 0 do
|
||||||
I := I + 1;
|
Inc(I);
|
||||||
while Comparer(P, ItemPtrs[J], Context) < 0 do
|
while Comparer(P, ItemPtrs[J], Context) < 0 do
|
||||||
J := J - 1;
|
Dec(J);
|
||||||
If I <= J then
|
If I <= J then
|
||||||
begin
|
begin
|
||||||
Q := ItemPtrs[I];
|
Q := ItemPtrs[I];
|
||||||
ItemPtrs[I] := ItemPtrs[J];
|
ItemPtrs[I] := ItemPtrs[J];
|
||||||
ItemPtrs[J] := Q;
|
ItemPtrs[J] := Q;
|
||||||
I := I + 1;
|
Inc(I);
|
||||||
J := J - 1;
|
Dec(J);
|
||||||
end;
|
end;
|
||||||
until I > J;
|
until I > J;
|
||||||
// sort the smaller range recursively
|
// sort the smaller range recursively
|
||||||
@ -166,16 +166,16 @@ var
|
|||||||
P := Items + ItemSize*((L + R) div 2);
|
P := Items + ItemSize*((L + R) div 2);
|
||||||
repeat
|
repeat
|
||||||
while Comparer(P, Items + ItemSize*I, Context) > 0 do
|
while Comparer(P, Items + ItemSize*I, Context) > 0 do
|
||||||
I := I + 1;
|
Inc(I);
|
||||||
while Comparer(P, Items + ItemSize*J, Context) < 0 do
|
while Comparer(P, Items + ItemSize*J, Context) < 0 do
|
||||||
J := J - 1;
|
Dec(J);
|
||||||
If I <= J then
|
If I <= J then
|
||||||
begin
|
begin
|
||||||
Move((Items + ItemSize*I)^, TempBuf^, ItemSize);
|
Move((Items + ItemSize*I)^, TempBuf^, ItemSize);
|
||||||
Move((Items + ItemSize*J)^, (Items + ItemSize*I)^, ItemSize);
|
Move((Items + ItemSize*J)^, (Items + ItemSize*I)^, ItemSize);
|
||||||
Move(TempBuf^, (Items + ItemSize*J)^, ItemSize);
|
Move(TempBuf^, (Items + ItemSize*J)^, ItemSize);
|
||||||
I := I + 1;
|
Inc(I);
|
||||||
J := J - 1;
|
Dec(J);
|
||||||
end;
|
end;
|
||||||
until I > J;
|
until I > J;
|
||||||
// sort the smaller range recursively
|
// sort the smaller range recursively
|
||||||
|
Loading…
Reference in New Issue
Block a user