hedgewars/adler32.pas
changeset 12758 49c31d8cc740
parent 10015 4feced261c68
equal deleted inserted replaced
12757:6f4ab0339c16 12758:49c31d8cc740
    63 As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need.
    63 As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need.
    64 That means no btypes, file loading, and the assembly version disabled.
    64 That means no btypes, file loading, and the assembly version disabled.
    65 Also, the structure was removed to simplify C conversion
    65 Also, the structure was removed to simplify C conversion
    66 *)
    66 *)
    67 
    67 
    68 function Adler32Update (var adler : longint; Msg     :Pointer; Len     :longint ) : longint;
    68 function Adler32Update (adler : longint; Msg     :Pointer; Len     :longint ) : longint;
    69 
    69 
    70 implementation
    70 implementation
    71 
    71 
    72 (*
    72 (*
    73 $ifdef BASM16
    73 $ifdef BASM16
   121     LH(adler).L := word(s1);
   121     LH(adler).L := word(s1);
   122     LH(adler).H := word(s2);
   122     LH(adler).H := word(s2);
   123 end;
   123 end;
   124 *)
   124 *)
   125 
   125 
   126 function Adler32Update(var adler:longint; Msg: Pointer; Len :longint) : longint;
   126 function Adler32Update(adler:longint; Msg: Pointer; Len :longint) : longint;
   127     {-update Adler32 with Msg data}
   127     {-update Adler32 with Msg data}
   128     const
   128     const
   129         BASE = 65521; {max. prime < 65536 }
   129         BASE = 65521; {max. prime < 65536 }
   130         NMAX = 3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31}
   130         NMAX = 3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31}
   131     var
   131     var