Re: Fastcode CharPosRev B&V 0.6.0
- From: "Davy Landman" <davy.landman@xxxxxxxxx>
- Date: Sun, 26 Nov 2006 10:42:46 +0100
Hi Dennis,
I created one new Pascal function...
On my Northwood it's slower.. but maybe on the other processors not?
I tried to get away the -1, -2, -3 .. Maybe it will be faster..
allthough it results in an extra dec eax instead of doing [edx-esi-$02] so..
who knows?
function CharPosRev_DLA_PAS_8(SearchChar: Char; const S: string): Integer;
var
p: PByteArray;
begin
Result := Length(S);
if Result <= 4 then
begin
p := Pointer(S);
for Result := Result downto 1 do
if p^[Result - 1] = Byte(SearchChar) then
begin
Exit;
end;
Result := 0;
Exit;
end;
Inc(Result, 3);
p := Pointer(Cardinal(S) - 4);
while Result >= 3 do
begin
if p^[Result] = Byte(SearchChar) then
begin
Dec(Result, 3);
Exit;
end;
Dec(Result);
if p^[Result] = Byte(SearchChar) then
begin
Dec(Result, 3);
Break;
end;
Dec(Result);
if p^[Result] = Byte(SearchChar) then
begin
Dec(Result, 3);
Break;
end;
Dec(Result);
if p^[Result] = Byte(SearchChar) then
begin
Dec(Result, 3);
Break;
end;
Dec(Result);
end;
if Result < 0 then {Match Found before First Char}
Result := 0;
end;
Regards,
Davy
.
- Follow-Ups:
- Re: Fastcode CharPosRev B&V 0.6.0
- From: John O'Harrow
- Re: Fastcode CharPosRev B&V 0.6.0
- References:
- Fastcode CharPosRev B&V 0.6.0
- From: Dennis
- Fastcode CharPosRev B&V 0.6.0
- Prev by Date: Re: Fastcode CharPosRev B&V 0.4.0
- Next by Date: Re: Fastcode CharPosRev B&V 0.6.0
- Previous by thread: Re: Fastcode CharPosRev B&V 0.6.0
- Next by thread: Re: Fastcode CharPosRev B&V 0.6.0
- Index(es):
Relevant Pages
|