mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-04 18:10:26 +02:00
* Reverse IndexOf. Increases speed of freeing collection with a factor N^2
git-svn-id: trunk@19268 -
This commit is contained in:
parent
448e3db450
commit
39d8ee1136
@ -198,9 +198,9 @@ end;
|
||||
|
||||
function TFPList.IndexOf(Item: Pointer): Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
while(Result < FCount) and (Flist^[Result] <> Item) do Result := Result + 1;
|
||||
If Result = FCount then Result := -1;
|
||||
Result:=Count-1;
|
||||
while (Result >=0) and (Flist^[Result]<>Item) do
|
||||
Result:=Result - 1;
|
||||
end;
|
||||
|
||||
procedure TFPList.Insert(Index: Integer; Item: Pointer);
|
||||
|
Loading…
Reference in New Issue
Block a user