B
baiduan
Unregistered / Unconfirmed
GUEST, unregistred user!
function cksum(addr: PWord; len: integer): Cardinal;
var
nleft: integer;
w: PWord;
answer: cardinal;
sum: integer;
begin
nleft := len;
w := addr;
sum := 0;
while (nleft > 1) do
begin
sum := sum +word(w^);
inc(w);
nleft := nleft - 2;
end;
sum := sum shr 16 + sum and $FFFF;
sum := sum + sum shr 16;
answer := not sum;
result := answer;
end;
var
nleft: integer;
w: PWord;
answer: cardinal;
sum: integer;
begin
nleft := len;
w := addr;
sum := 0;
while (nleft > 1) do
begin
sum := sum +word(w^);
inc(w);
nleft := nleft - 2;
end;
sum := sum shr 16 + sum and $FFFF;
sum := sum + sum shr 16;
answer := not sum;
result := answer;
end;