[Mndiff-dev] [mndiff]: r42 - trunk/mnzip/mnzip.c

michael subversion at mplayerhq.hu
Thu Jun 21 20:37:02 CEST 2007


Author: michael
Date: Thu Jun 21 20:37:02 2007
New Revision: 42

Log:
reuse begin of idx2 to improve cache useage and swaping if not enough memory


Modified:
   trunk/mnzip/mnzip.c

Modified: trunk/mnzip/mnzip.c
==============================================================================
--- trunk/mnzip/mnzip.c	(original)
+++ trunk/mnzip/mnzip.c	Thu Jun 21 20:37:02 2007
@@ -365,16 +365,16 @@ fprintf(stderr, "idx init done\n");
 #define limit(i) ((i)>=len ? (i) - len : (i))
             assert(right-(int)i+1 > 1);
             for(j=i; j<=right; j++){
-                idx2[j]= idx[limit(ptr[j] - in + sorted)];
+                idx2[j-i]= idx[limit(ptr[j] - in + sorted)];
 //                assert(idx[ptr[j] - in] == idx[ptr[i] - in]);
             }
-            qsort2(ptr + i, idx2 + i, right-i+1);
+            qsort2(ptr + i, idx2, right-i+1);
 
             last= right;
             assert(idx[ptr[right]-in] == right);
             last2= right+1;
             for(j=right-1; (int)j>=(int)i; j--){
-                if(idx2[j] < idx2[j+1]){
+                if(idx2[j-i] < idx2[j-i+1]){
                     assert(last - j >= 1);
                     if(last - j > 1){
                         last2= j+1;



More information about the Mndiff-dev mailing list