* use SizeUInt instead of longint for the array indices in the quicksort

implementations. This:
  1) allows sorting arrays with >4G elements on 64-bit systems
  2) allows sorting arrays with up to 4G (>2G) elements on 32-bit systems
  3) uses 16-bit instead of the less efficient 32-bit indices on 16-bit and
     8-bit platforms

git-svn-id: trunk@41230 -
This commit is contained in:
nickysn 2019-02-05 16:20:56 +00:00
parent f5f25f7ae6
commit bea9961d2d

View File

@ -64,10 +64,10 @@ var
implementation
Procedure QuickSort_PtrList_NoContext(ItemPtrs: PPointer; L, R : Longint;
Procedure QuickSort_PtrList_NoContext(ItemPtrs: PPointer; L, R : SizeUInt;
Comparer: TListSortComparer_NoContext);
var
I, J, PivotIdx : Longint;
I, J, PivotIdx : SizeUInt;
P, Q : Pointer;
begin
repeat
@ -132,9 +132,9 @@ end;
procedure QuickSort_PtrList_Context(ItemPtrs: PPointer; ItemCount: SizeUInt; Comparer: TListSortComparer_Context; Context: Pointer);
procedure QuickSort(L, R : Longint);
procedure QuickSort(L, R : SizeUInt);
var
I, J, PivotIdx : Longint;
I, J, PivotIdx : SizeUInt;
P, Q : Pointer;
begin
repeat
@ -201,9 +201,9 @@ procedure QuickSort_ItemList_Context(Items: Pointer; ItemCount, ItemSize: SizeUI
var
TempBuf: Pointer;
procedure QuickSort(L, R : Longint);
procedure QuickSort(L, R : SizeUInt);
var
I, J, PivotIdx : Longint;
I, J, PivotIdx : SizeUInt;
P : Pointer;
begin
repeat
@ -279,9 +279,9 @@ procedure QuickSort_ItemList_CustomItemExchanger_Context(
Exchanger: TListSortCustomItemExchanger_Context;
Context: Pointer);
procedure QuickSort(L, R : Longint);
procedure QuickSort(L, R : SizeUInt);
var
I, J, PivotIdx : Longint;
I, J, PivotIdx : SizeUInt;
P : Pointer;
begin
repeat