[Scummvm-cvs-logs] CVS: scummvm/scumm imuse_digi.cpp,1.77,1.78

Max Horn fingolfin at users.sourceforge.net
Thu Dec 25 06:04:01 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv10556

Modified Files:
	imuse_digi.cpp 
Log Message:
cleanup (TODO: reduce code duplication)

Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- imuse_digi.cpp	25 Dec 2003 14:01:38 -0000	1.77
+++ imuse_digi.cpp	25 Dec 2003 14:03:04 -0000	1.78
@@ -687,8 +687,8 @@
 }
 
 static uint32 decode12BitsSample(byte *src, byte **dst, uint32 size, bool stereo) {
-	uint32 s_size = (size / 3) * 4;
-	uint32 loop_size = s_size / 4;
+	uint32 loop_size = size / 3;
+	uint32 s_size = loop_size * 4;
 	if (stereo) {
 		s_size *= 2;
 	}
@@ -700,18 +700,14 @@
 		byte v2 = *src++;
 		byte v3 = *src++;
 		tmp = ((((v2 & 0x0f) << 8) | v1) << 4) - 0x8000;
-		*ptr++ = (byte)((tmp >> 8) & 0xff);
-		*ptr++ = (byte)(tmp & 0xff);
+		WRITE_BE_UINT16(ptr, tmp); ptr += 2;
 		if (stereo) {
-			*ptr++ = (byte)((tmp >> 8) & 0xff);
-			*ptr++ = (byte)(tmp & 0xff);
+			WRITE_BE_UINT16(ptr, tmp); ptr += 2;
 		}
 		tmp = ((((v2 & 0xf0) << 4) | v3) << 4) - 0x8000;
-		*ptr++ = (byte)((tmp >> 8) & 0xff);
-		*ptr++ = (byte)(tmp & 0xff);
+		WRITE_BE_UINT16(ptr, tmp); ptr += 2;
 		if (stereo) {
-			*ptr++ = (byte)((tmp >> 8) & 0xff);
-			*ptr++ = (byte)(tmp & 0xff);
+			WRITE_BE_UINT16(ptr, tmp); ptr += 2;
 		}
 	}
 	return s_size;





More information about the Scummvm-git-logs mailing list