anchor.diff:    if S.Size <> 0 then
       for I := 0 to S.Size - 1 do
       begin
  -      Inc(A, pbyte(Cardinal(S.Memory) + I)^);
  -      B := (B + A) mod 65521; // 65521 (the largest prime number smaller than 2^16)
  +      Inc(A, pByte(Cardinal(S.Memory) + I)^);
  +      B := (B + A) mod MAX_PRIME_16BIT;
       end;
  -  A := A mod 65521;
  +  A := A mod MAX_PRIME_16BIT;
     Result := B + A shl 16; // reverse order for smaller numbers
   end;
   
  
positive.code: end;
  
  
  function Adler32CRC(TextPointer: Pointer; TextLength: Cardinal): Cardinal;
  var
    I, A, B: Cardinal;
  begin
    A := 1;
    B := 0; // A is initialized to 1, B to 0
    for I := 1 to TextLength do
    begin
      Inc(A, pbyte(Cardinal(TextPointer) + I - 1)^);
      Inc(B, A);
    end;
    A := A mod 65521; // 65521 (the largest prime number smaller than 2^16)
    B := B mod 65521;
    Adler32CRC := B + A shl 16; // reverse order for smaller numbers
  end;
  
  
negative.code: 
  
  function Adler32CRC(S: TMemoryStream): Cardinal;
  const
    MAX_PRIME_16BIT = 65521; // 65521 is the largest prime number smaller than 2^16
  var
    I, A, B: Cardinal;
  begin
  