mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-25 12:29:25 +02:00
* optimize fpglist.indexof, indexed array generates more optimal code than manual index multiplication
git-svn-id: trunk@5751 -
This commit is contained in:
parent
bdfd3e5453
commit
467cd39091
@ -83,6 +83,7 @@ type
|
|||||||
generic TFPGList<T> = class(TFPSList)
|
generic TFPGList<T> = class(TFPSList)
|
||||||
type public
|
type public
|
||||||
TCompareFunc = function(const Item1, Item2: T): Integer;
|
TCompareFunc = function(const Item1, Item2: T): Integer;
|
||||||
|
PT = ^T;
|
||||||
var protected
|
var protected
|
||||||
FOnCompare: TCompareFunc;
|
FOnCompare: TCompareFunc;
|
||||||
procedure CopyItem(Src, Dest: Pointer); override;
|
procedure CopyItem(Src, Dest: Pointer); override;
|
||||||
@ -593,7 +594,7 @@ function TFPGList.IndexOf(const Item: T): Integer;
|
|||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
{$warning TODO: fix inlining to work! InternalItems[Result]^}
|
{$warning TODO: fix inlining to work! InternalItems[Result]^}
|
||||||
while (Result < FCount) and (T(Pointer(FList+Result*sizeof(T))^) <> Item) do
|
while (Result < FCount) and (PT(FList)[Result] <> Item) do
|
||||||
Inc(Result);
|
Inc(Result);
|
||||||
{$warning TODO: Result := -1; does not compile }
|
{$warning TODO: Result := -1; does not compile }
|
||||||
if Result = FCount then
|
if Result = FCount then
|
||||||
|
Loading…
Reference in New Issue
Block a user