equal
deleted
inserted
replaced
64 As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need. |
64 As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need. |
65 That means no btypes, file loading, and the assembly version disabled. |
65 That means no btypes, file loading, and the assembly version disabled. |
66 Also, the structure was removed to simplify C conversion |
66 Also, the structure was removed to simplify C conversion |
67 *) |
67 *) |
68 |
68 |
69 procedure Adler32Update ( var adler :longint; Msg :pointer; Len :longint ); |
69 function Adler32Update ( var adler :longint; Msg :pointer; Len :longint ) : longint; |
70 |
70 |
71 implementation |
71 implementation |
72 |
72 |
73 (* |
73 (* |
74 $ifdef BASM16 |
74 $ifdef BASM16 |
122 LH(adler).L := word(s1); |
122 LH(adler).L := word(s1); |
123 LH(adler).H := word(s2); |
123 LH(adler).H := word(s2); |
124 end; |
124 end; |
125 *) |
125 *) |
126 |
126 |
127 procedure Adler32Update(var adler: longint; Msg: pointer; Len :longint); |
127 function Adler32Update(var adler: longint; Msg: pointer; Len :longint) : longint; |
128 {-update Adler32 with Msg data} |
128 {-update Adler32 with Msg data} |
129 const |
129 const |
130 BASE = 65521; {max. prime < 65536 } |
130 BASE = 65521; {max. prime < 65536 } |
131 NMAX = 3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31} |
131 NMAX = 3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31} |
132 var |
132 var |
150 end; |
150 end; |
151 s1 := s1 mod BASE; |
151 s1 := s1 mod BASE; |
152 s2 := s2 mod BASE; |
152 s2 := s2 mod BASE; |
153 dec(len, n); |
153 dec(len, n); |
154 end; |
154 end; |
155 adler:= (s2 shl 16) or s1; |
155 Adler32Update:= (s2 shl 16) or s1; |
156 end; |
156 end; |
157 |
157 |
158 end. |
158 end. |