# HG changeset patch
# User nemo
# Date 1335301099 14400
# Node ID 6e832f8f4d8e3f4da6245cd56b7bbce147f0d448
# Parent  1fbf9266ba5256164dc7f2dbd4894dc2520271af
Make adler32 friendlier for pas2c - this should work the same (needs testing ofc)

diff -r 1fbf9266ba52 -r 6e832f8f4d8e hedgewars/adler32.pas
--- a/hedgewars/adler32.pas	Tue Apr 24 23:56:41 2012 +0400
+++ b/hedgewars/adler32.pas	Tue Apr 24 16:58:19 2012 -0400
@@ -63,6 +63,7 @@
 (*
 As per the license above, noting that this implementation of adler32 was stripped of everything we didn't need.
 That means no btypes, file loading, and the assembly version disabled.
+Also, the structure was removed to simplify C conversion
 *)
 
 procedure Adler32Update ( var adler     :longint; Msg     :pointer; Len     :longint );
@@ -128,16 +129,12 @@
     const
         BASE = 65521; {max. prime < 65536 }
         NMAX = 3854; {max. n with 255n(n+1)/2 + (n+1)(BASE-1) < 2^31}
-    type
-        LH = packed record
-            L, H: word;
-            end;
     var
         s1, s2: longint;
         i, n: integer;
     begin
-        s1 := LH(adler).L;
-        s2 := LH(adler).H;
+        s1 := adler and $FFFF;
+        s2 := adler shr 16;
         while Len>0 do
             begin
             if Len<NMAX then
@@ -155,8 +152,7 @@
             s2 := s2 mod BASE;
             dec(len, n);
             end;
-        LH(adler).L := word(s1);
-        LH(adler).H := word(s2);
+        adler:= (s2 shl 16) or s1;
     end;
 
 end.
diff -r 1fbf9266ba52 -r 6e832f8f4d8e hedgewars/pas2cSystem.pas
--- a/hedgewars/pas2cSystem.pas	Tue Apr 24 23:56:41 2012 +0400
+++ b/hedgewars/pas2cSystem.pas	Tue Apr 24 16:58:19 2012 -0400
@@ -36,6 +36,7 @@
 
     char = char;
     PChar = ^char;
+    PPChar = ^Pchar;
     
     PByte = ^Byte;
     PLongInt = ^LongInt;