[Scummvm-cvs-logs] CVS: scummvm/scumm bundle.cpp,1.25,1.26

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Jan 25 11:39:03 CET 2003


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

Modified Files:
	bundle.cpp 
Log Message:
some cleanup

Index: bundle.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/bundle.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- bundle.cpp	25 Jan 2003 18:41:32 -0000	1.25
+++ bundle.cpp	25 Jan 2003 19:38:54 -0000	1.26
@@ -506,24 +506,24 @@
 			s = 0;
 			j = 0;
 			do {
-				ptr = src + length + (k / 2);
+				ptr = src + length + (k >> 1);
 				if (k & 1) {
-					r = c / 8;
-					*(t_table + r + 2) = ((*(src + j) & 0x0f) << 4) | ((*(ptr + 1) & 0xf0) >> 4);
-					*(t_table + r + 1) = (*(src + j) & 0xf0) | (*(t_table + r + 1));
+					r = c >> 3;
+					t_table[r + 2] = ((src[j] & 0x0f) << 4) | (ptr[1] >> 4);
+					t_table[r + 1] = (src[j] & 0xf0) | (t_table[r + 1]);
 				} else {
-					r = s / 8;
-					*(t_table + r + 0) = ((*(src + j) & 0x0f) << 4) | (*ptr & 0x0f);
-					*(t_table + r + 1) = (*(src + j) & 0xf0) >> 4;
+					r = s >> 3;
+					t_table[r + 0] = ((src[j] & 0x0f) << 4) | (ptr[0] & 0x0f);
+					t_table[r + 1] = src[j] >> 4;
 				}
 				s += 12;
+				c += 12;
 				k++;
 				j++;
-				c += 12;
 			} while (k < length);
 		}
 		offset1 = ((length - 1) * 3) / 2;
-		*(t_table + offset1 + 1) = (*(t_table + offset1 + 1)) | *(src + length - 1) & 0xf0;
+		t_table[offset1 + 1] = (t_table[offset1 + 1]) | (src[length - 1] & 0xf0);
 		memcpy(src, t_table, output_size);
 		free(t_table);
 		break;
@@ -544,25 +544,25 @@
 		k = 1;
 		c = 0;
 		s = 12;
-		*t_table = (*(src + length)) >> 4;
+		t_table[0] = src[length] / 16;
 		t = length + k;
 		j = 1;
 		if (t > k) {
 			do {
-				ptr = src + length + (k / 2);
+				ptr = src + length + (k >> 1);
 				if (k & 1) {
-					r = c / 8;
-					*(t_table + r + 0) = (*(src + j - 1) & 0xf0) | (*(t_table + r));
-					*(t_table + r + 1) = ((*(src + j - 1) & 0x0f) << 4) | (*ptr & 0x0f);
+					r = c >> 3;
+					t_table[r + 0] = (src[j - 1] & 0xf0) | t_table[r];
+					t_table[r + 1] = ((src[j - 1] & 0x0f) << 4) | (ptr[0] & 0x0f);
 				} else {
-					r = s / 8;
-					*(t_table + r + 0) = (*(src + j - 1) & 0xf0) >> 4;
-					*(t_table + r - 1) = ((*(src + j - 1) & 0x0f) << 4) | ((*ptr & 0xf0) >> 4);
+					r = s >> 3;
+					t_table[r + 0] = src[j - 1] >> 4;
+					t_table[r - 1] = ((src[j - 1] & 0x0f) << 4) | (ptr[0] >> 4);
 				}
 				s += 12;
+				c += 12;
 				k++;
 				j++;
-				c += 12;
 			} while (k < t);
 		}
 		memcpy(src, t_table, output_size);
@@ -586,25 +586,25 @@
 		c = 0;
 		j = 0;
 		s = -12;
-		*t_table = *(output_size + src - 1);
-		*(t_table + output_size - 1) = *(src + length - 1);
+		t_table[0] = src[output_size - 1];
+		t_table[output_size - 1] = src[length - 1];
 		t = length - 1;
 		if (t > 0) {
 			do {
-				ptr = src + length + (k / 2);
+				ptr = src + length + (k >> 1);
 				if (k & 1) {
-					r = s / 8;
-					*(t_table + r + 2) = (*(src + j) & 0xf0) | *(t_table + r + 2);
-					*(t_table + r + 3) = ((*(src + j) & 0x0f) << 4) | ((*ptr & 0xf0) >> 4);
+					r = s >> 3;
+					t_table[r + 2] = (src[j] & 0xf0) | *(t_table + r + 2);
+					t_table[r + 3] = ((src[j] & 0x0f) << 4) | (ptr[0] >> 4);
 				} else {
-					r = c / 8;
-					*(t_table + r + 2) = (*(src + j) & 0xf0) >> 4;
-					*(t_table + r + 1) = ((*(src + j) & 0x0f) << 4) | (*ptr & 0x0f);
+					r = c >> 3;
+					t_table[r + 2] = src[j] >> 4;
+					t_table[r + 1] = ((src[j] & 0x0f) << 4) | (ptr[0] & 0x0f);
 				}
 				s += 12;
+				c += 12;
 				k++;
 				j++;
-				c += 12;
 			} while (k < t);
 		}
 		memcpy(src, t_table, output_size);
@@ -632,8 +632,8 @@
 			offset1--;
 			offset2 -= 2;
 			offset3--;
-			*(t_table + offset2 + 0) = *(src + offset1);
-			*(t_table + offset2 + 1) = *(src + offset3);
+			t_table[offset2 + 0] = src[offset1];
+			t_table[offset2 + 1] = src[offset3];
 		} while (1);
 
 		src = comp_output;
@@ -643,27 +643,27 @@
 			c = -12;
 			s = 0;
 			do {
-				j = length + (k / 2);
+				j = length + (k >> 1);
 				if (k & 1) {
-					r = c / 8;
-					t_tmp1 = *(t_table + k);
-					t_tmp2 = *(t_table + j + 1);
-					*(src + r + 2) = ((t_tmp1 & 0x0f) << 4) | ((t_tmp2 & 0xf0) >> 4);
-					*(src + r + 1) = (*(src + r + 1)) | (t_tmp1 & 0xf0);
+					r = c >> 3;
+					t_tmp1 = t_table[k];
+					t_tmp2 = t_table[j + 1];
+					src[r + 2] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 >> 4);
+					src[r + 1] = (src[r + 1]) | (t_tmp1 & 0xf0);
 				} else {
-					r = s / 8;
-					t_tmp1 = *(t_table + k);
-					t_tmp2 = *(t_table + j);
-					*(src + r + 0) = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
-					*(src + r + 1) = ((t_tmp1 & 0xf0) >> 4);
+					r = s >> 3;
+					t_tmp1 = t_table[k];
+					t_tmp2 = t_table[j];
+					src[r + 0] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
+					src[r + 1] = t_tmp1 >> 4;
 				}
 				s += 12;
-				k++;
 				c += 12;
+				k++;
 			} while (k < length);
 		}
 		offset1 = ((length - 1) * 3) / 2;
-		*(src + offset1 + 1) = (*(t_table + length) & 0xf0) | *(src + offset1 + 1);
+		src[offset1 + 1] = (t_table[length] & 0xf0) | src[offset1 + 1];
 		free(t_table);
 		break;
 
@@ -688,8 +688,8 @@
 			offset1--;
 			offset2 -= 2;
 			offset3--;
-			*(t_table + offset2 + 0) = *(src + offset1);
-			*(t_table + offset2 + 1) = *(src + offset3);
+			t_table[offset2 + 0] = src[offset1];
+			t_table[offset2 + 1] = src[offset3];
 		} while (1);
 
 		src = comp_output;
@@ -697,28 +697,28 @@
 		k = 1;
 		c = 0;
 		s = 12;
-		t_tmp1 = (*(t_table + length)) >> 4;
-		*(src) = t_tmp1;
+		t_tmp1 = t_table[length] / 16;
+		src[0] = t_tmp1;
 		t = length + k;
 		if (t > k) {
 			do {
 				j = length + (k / 2);
 				if (k & 1) {
-					r = c / 8;
-					t_tmp1 = *(t_table + k - 1);
-					t_tmp2 = *(t_table + j);
-					*(src + r + 0) = (*(src + r)) | (t_tmp1 & 0xf0);
-					*(src + r + 1) = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
+					r = c >> 3;
+					t_tmp1 = t_table[k - 1];
+					t_tmp2 = t_table[j];
+					src[r + 0] = (src[r]) | (t_tmp1 & 0xf0);
+					src[r + 1] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
 				} else {
-					r = s / 8;
-					t_tmp1 = *(t_table + k - 1);
-					t_tmp2 = *(t_table + j);
-					*(src + r + 0) = (t_tmp1 & 0xf0) >> 4;
-					*(src + r - 1) = ((t_tmp1 & 0x0f) << 4) | ((t_tmp2 & 0xf0) >> 4);
+					r = s >> 3;
+					t_tmp1 = t_table[k - 1];
+					t_tmp2 = t_table[j];
+					src[r + 0] = t_tmp1 >> 4;
+					src[r - 1] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 >> 4);
 				}
 				s += 12;
-				k++;
 				c += 12;
+				k++;
 			} while (k < t);
 		}
 		free(t_table);
@@ -745,8 +745,8 @@
 			offset1--;
 			offset2 -= 2;
 			offset3--;
-			*(t_table + offset2 + 0) = *(src + offset1);
-			*(t_table + offset2 + 1) = *(src + offset3);
+			t_table[offset2 + 0] = src[offset1];
+			t_table[offset2 + 1] = src[offset3];
 		} while (1);
 
 		src = comp_output;
@@ -754,28 +754,28 @@
 		k = 0;
 		c = 0;
 		s = -12;
-		*(src) = *(output_size + t_table - 1);
-		*(src + output_size - 1) = *(t_table + length - 1);
+		src[0] = t_table[output_size - 1];
+		src[output_size - 1] = t_table[length - 1];
 		t = length - 1;
 		if (t > 0) {
 			do {
-				j = length + (k / 2);
+				j = length + (k >> 1);
 				if (k & 1) {
-					r = s / 8;
-					t_tmp1 = *(t_table + k);
-					t_tmp2 = *(t_table + j);
-					*(src + r + 2) = (*(src + r + 2)) | (t_tmp1 & 0xf0);
-					*(src + r + 3) = ((t_tmp1 & 0x0f) << 4) | ((t_tmp2 & 0xf0) >> 4);
+					r = s >> 3;
+					t_tmp1 = t_table[k];
+					t_tmp2 = t_table[j];
+					src[r + 2] = (src[r + 2]) | (t_tmp1 & 0xf0);
+					src[r + 3] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 >> 4);
 				} else {
-					r = c / 8;
-					t_tmp1 = *(t_table + k);
-					t_tmp2 = *(t_table + j);
-					*(src + r + 2) = (t_tmp1 & 0xf0) >> 4;
-					*(src + r + 1) = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
+					r = c >> 3;
+					t_tmp1 = t_table[k];
+					t_tmp2 = t_table[j];
+					src[r + 2] = t_tmp1 >> 4;
+					src[r + 1] = ((t_tmp1 & 0x0f) << 4) | (t_tmp2 & 0x0f);
 				}
 				s += 12;
-				k++;
 				c += 12;
+				k++;
 			} while (k < t);
 		}
 		free(t_table);





More information about the Scummvm-git-logs mailing list