소스 검색

* Reverse IndexOf. Increases speed of freeing collection with a factor N^2

git-svn-id: trunk@19268 -
michael 14 년 전
부모
커밋
39d8ee1136
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      rtl/objpas/classes/lists.inc

+ 3 - 3
rtl/objpas/classes/lists.inc

@@ -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);