Re: Fastcode CompareMem B&V 1.0
- From: "Aleksandr Sharahov" <alsha-on-mail333.com>
- Date: Fri, 29 Apr 2005 01:23:01 +0400
Hi Dennis,
Here is Pascal version.
--
regards
Aleksandr
{$UNDEF SaveQ} {$IFOPT Q+} {$Q-} {$DEFINE SaveQ} {$ENDIF}
{$UNDEF SaveR} {$IFOPT R+} {$R-} {$DEFINE SaveR} {$ENDIF}
function CompareMem_Sha_Pas_1_a(p1, p2: pointer; length: integer): boolean;
var
q1, q2: pIntegerArray;
c: cardinal;
label
Ret0;
begin;
c:=length;
c:=c+cardinal(p1)-8;
q1:=p1;
q2:=p2;
if c>=cardinal(q1) then begin;;
if q1[0]<>q2[0] then goto Ret0;
inc(cardinal(q1),4);
inc(cardinal(q2),4);
dec(cardinal(q2),cardinal(q1));
cardinal(q1):=cardinal(q1) and -4;
inc(cardinal(q2),cardinal(q1));
if c>=cardinal(q1) then repeat;
if q1[0]<>q2[0] then goto Ret0;
if q1[1]<>q2[1] then goto Ret0;
inc(cardinal(q1),8);
inc(cardinal(q2),8);
until c<cardinal(q1);
end;
c:=c-cardinal(q1)+8;
if c>=4 then begin;
if q1[0]<>q2[0] then goto Ret0;
inc(cardinal(q1),4);
inc(cardinal(q2),4);
end;
if c and 2<>0 then begin;
if pword(q1)^<>pword(q2)^ then goto Ret0;
inc(cardinal(q1),2);
inc(cardinal(q2),2);
end;
if c and 1<>0 then if pchar(q1)^<>pchar(q2)^ then goto Ret0;
Result:=true;
exit;
Ret0:
Result:=false;
end;
{$IFDEF SaveQ} {$Q+} {$UNDEF SaveQ} {$ENDIF}
{$IFDEF SaveR} {$R+} {$UNDEF SaveR} {$ENDIF}
.
- Follow-Ups:
- Re: Fastcode CompareMem B&V 1.0
- From: Aleksandr Sharahov
- Re: Fastcode CompareMem B&V 1.0
- References:
- Fastcode CompareMem B&V 1.0
- From: Dennis
- Fastcode CompareMem B&V 1.0
- Prev by Date: Re: Fastcode CompareMem B&V 1.0
- Next by Date: Re: Fastcode CompareMem B&V 1.0
- Previous by thread: Re: Fastcode CompareMem B&V 1.0
- Next by thread: Re: Fastcode CompareMem B&V 1.0
- Index(es):
Relevant Pages
|