>Just as a matter of interest, I came up with my own fast method working
>along the lines of John's method but I think this is tidier.
This is starting to resemble a coding competition! Here's my suggestion:
function IsZero(const AddrOfDataToSearch:Pointer; const
LengthInBytes:LongWord) : boolean;
var
p:pLongWord; //pLongWord defined System unit in D7
i:LongWord;
begin
p:=pLongWord(AddrOfDataToSearch);
result:=false;
for i:=0 to ((LengthInBytes div 4)-1) do
if p^ <> 0 then
exit
else
inc(p);
case LengthInBytes mod 4 of
0: result:=true;
1: if pByte(p)^=0 then result:=true;
2: if pWord(p)^=0 then result:=true;
3: if ((pWord(p)^=0) and (PByte(LongWord(p)+2)^=0)) then result:=true;
end;
end;//IsZero
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi