git » fp-git.git » commit 64c7e87

more simplification and variable separation

author ecalot
2005-03-09 21:08:30 UTC
committer ecalot
2005-03-09 21:08:30 UTC
parent c71d439eed09b7ecb1a2adb3a5e3991de261fa51

more simplification and variable separation

stuff/contest/lzg/uncompress.c +9 -4

diff --git a/stuff/contest/lzg/uncompress.c b/stuff/contest/lzg/uncompress.c
index 2db5c30..2ed9c58 100644
--- a/stuff/contest/lzg/uncompress.c
+++ b/stuff/contest/lzg/uncompress.c
@@ -62,15 +62,20 @@ void expandLzg(const unsigned char* array, int arraySize,
 				
 				/* Here is the difference between big and small images */
 				while (rep--) {
-					h=(cursor-(location%MAX_MXD_SIZE_IN_LZG))/MAX_MXD_SIZE_IN_LZG;
+					location=location%MAX_MXD_SIZE_IN_LZG; /* location is in range 0-1023 */
+
+					h=(cursor-location)/MAX_MXD_SIZE_IN_LZG;
 					/*
 					 * if the image is stored in an array of 1024 x n bytes
 					 * "h" is the height and "location" is the width
 					 */
-					img[cursor++]=img[
-						((h<0)?0:h)*MAX_MXD_SIZE_IN_LZG+
-						(location++)%MAX_MXD_SIZE_IN_LZG
+					img[cursor]=img[
+						h*MAX_MXD_SIZE_IN_LZG+
+						location
 					];
+
+					cursor++;
+					location++;
 				}
 			}
 		}