* Fixed CompareDWord.

git-svn-id: trunk@9058 -
This commit is contained in:
yury 2007-11-02 11:19:10 +00:00
parent e716ac6b6b
commit 3d1d9815ac

View File

@ -491,9 +491,7 @@ function CompareDWord(Const buf1,buf2;len:SizeInt):SizeInt;
var var
aligncount : sizeint; aligncount : sizeint;
psrc,pdest,pend : pdword; psrc,pdest,pend : pdword;
b : ptrint;
begin begin
b:=0;
psrc:=@buf1; psrc:=@buf1;
pdest:=@buf2; pdest:=@buf2;
if (len>4*sizeof(ptruint)-11) if (len>4*sizeof(ptruint)-11)
@ -508,14 +506,11 @@ begin
pend:=psrc+aligncount; pend:=psrc+aligncount;
while psrc<pend do while psrc<pend do
begin begin
b:=(ptrint(psrc^)-ptrint(pdest^)); if psrc^<>pdest^ then
if b<>0 then if psrc^>pdest^ then
begin exit(1)
if b<0 then else
exit(-1) exit(-1);
else
exit(1);
end;
inc(pdest); inc(pdest);
inc(psrc); inc(psrc);
end; end;
@ -524,8 +519,7 @@ begin
len:=((len*4) and (sizeof(PtrUInt)-1)) shr 2; len:=((len*4) and (sizeof(PtrUInt)-1)) shr 2;
while psrc<pend do while psrc<pend do
begin begin
b:=(pptrint(psrc)^-pptrint(pdest)^); if pptrint(psrc)^<>pptrint(pdest)^ then
if b<>0 then
begin begin
len:=sizeof(ptruint) shr 2; len:=sizeof(ptruint) shr 2;
break; break;
@ -543,14 +537,11 @@ begin
if ((PtrUInt(pdest) and 3) or (PtrUInt(psrc) and 3))<>0 then if ((PtrUInt(pdest) and 3) or (PtrUInt(psrc) and 3))<>0 then
while psrc<pend do while psrc<pend do
begin begin
b:=(ptrint(unaligned(psrc^))-ptrint(unaligned(pdest^))); if unaligned(psrc^)<>unaligned(pdest^) then
if b<>0 then if unaligned(psrc^)>unaligned(pdest^) then
begin exit(1)
if b<0 then else
exit(-1) exit(-1);
else
exit(1);
end;
inc(pdest); inc(pdest);
inc(psrc); inc(psrc);
end end
@ -558,14 +549,11 @@ begin
{$endif FPC_REQUIRES_PROPER_ALIGNMENT} {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
while psrc<pend do while psrc<pend do
begin begin
b:=(ptrint(psrc^)-ptrint(pdest^)); if psrc^<>pdest^ then
if b<>0 then if psrc^>pdest^ then
begin exit(1)
if b<0 then else
exit(-1) exit(-1);
else
exit(1);
end;
inc(pdest); inc(pdest);
inc(psrc); inc(psrc);
end; end;