[Scummvm-cvs-logs] CVS: scummvm/sky rnc_deco.cpp,1.12,1.13

Max Horn fingolfin at users.sourceforge.net
Thu Mar 6 08:56:06 CET 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv13979

Modified Files:
	rnc_deco.cpp 
Log Message:
More cleanup

Index: rnc_deco.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/rnc_deco.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- rnc_deco.cpp	6 Mar 2003 16:33:29 -0000	1.12
+++ rnc_deco.cpp	6 Mar 2003 16:55:15 -0000	1.13
@@ -20,13 +20,11 @@
  */
 
 #include <string.h>
+#include <stdio.h>
+#include <assert.h>
 #include "common/scummsys.h"
 #include "sky/rnc_deco.h"
 
-#define ROL(x, n) (((x) << (n)) | ((x) >> (16 - (n))))
-#define ROR(x, n) (((x) << (16 - (n))) | ((x) >> (n)))
-#define XCHG(a, b) (a ^=b, b ^= a, a ^= b)
-
 //conditional flags
 #define CHECKSUMS	   1
 #define PROTECTED	   0
@@ -105,18 +103,16 @@
 
 	if (newBitCount < 0) {
 		newBitCount += amount;
-		XCHG(newBitCount, amount);
-		remBits = ROR((uint16)(((1 << amount) - 1) & newBitBuffh), amount);
-		newBitBuffh >>= amount;
-		newBitBuffl >>= amount;
+		remBits = (newBitBuffh << (16-newBitCount));
+		newBitBuffh >>= newBitCount;
+		newBitBuffl >>= newBitCount;
 		newBitBuffl |= remBits;	
 		_srcPtr += 2;
 		newBitBuffh = READ_LE_UINT16(_srcPtr);
-		XCHG(newBitCount, amount);
 		amount -= newBitCount;
 		newBitCount = 16 - amount;
 	}
-	remBits = ROR((uint16)(((1 << amount) - 1) & newBitBuffh), amount);
+	remBits = (newBitBuffh << (16-amount));
 	_bitBuffh = newBitBuffh >> amount;
 	_bitBuffl = (newBitBuffl >> amount) | remBits;
 	_bitCount = (uint8)newBitCount;
@@ -256,18 +252,12 @@
 				memcpy(_dstPtr, _srcPtr, inputLength); //memcpy is allowed here
 				_dstPtr += inputLength;
 				_srcPtr += inputLength;
-				uint16 b = READ_LE_UINT16(_srcPtr);
-				uint16 a = ROL(b, _bitCount);
-				uint16 d = ((1 << _bitCount) - 1);
-				_bitBuffl &= d;
-				d &= a;
+				uint16 a = READ_LE_UINT16(_srcPtr);
+				uint16 b = READ_LE_UINT16(_srcPtr + 2);
 
-				a = READ_LE_UINT16((_srcPtr + 2));
-				b = (b << _bitCount);
-				a = (a << _bitCount);
-				a |= d;
-				_bitBuffl |= b;
-				_bitBuffh = a;
+				_bitBuffl &= ((1 << _bitCount) - 1);
+				_bitBuffl |= (a << _bitCount);
+				_bitBuffh = (a >> (16 - _bitCount)) | (b << _bitCount);
 			}
 
 			if (counts > 1) {





More information about the Scummvm-git-logs mailing list