diff lwasm/lwasm.c @ 238:a9a14e6b4bc8

Fixed os9 module CRC calculation
author lost
date Sat, 15 Aug 2009 05:26:02 +0000
parents a58f49a77441
children 1106ec189e4f
line wrap: on
line diff
--- a/lwasm/lwasm.c	Fri Aug 14 04:20:15 2009 +0000
+++ b/lwasm/lwasm.c	Sat Aug 15 05:26:02 2009 +0000
@@ -103,16 +103,21 @@
 		// calc the CRC
 		b &= 0xff;
 		
-		b ^= (as -> crc) >> 16;
-		as -> crc <<= 8;
-		as -> crc ^= b << 1;
-		as -> crc ^= b << 6;
-		b ^= b << 1;
-		b ^= b << 2;
-		b ^= b << 4;
+		b ^= (as -> crc)[0];
+		(as -> crc)[0] = (as -> crc)[1];
+		(as -> crc)[1] = (as -> crc)[2];
+		(as -> crc)[1] ^= (b >> 7);
+		(as -> crc)[2] = (b << 1);
+		(as -> crc)[1] ^= (b >> 2);
+		(as -> crc)[2] ^= (b << 6);
+		b ^= (b << 1);
+		b ^= (b << 2);
+		b ^= (b << 4);
 		if (b & 0x80)
-			as -> crc ^= 0x800021;
-		as -> crc &= 0xffffff;
+		{
+			(as -> crc)[0] ^= 0x80;
+			(as -> crc)[2] ^= 0x21;
+		}
 	}
 }