]> mj.ucw.cz Git - libucw.git/commitdiff
if SORT_PRESORT and SORT_UP_TO are both on, compute the initial number of
authorRobert Spalek <robert@ucw.cz>
Tue, 9 Nov 2004 17:48:52 +0000 (17:48 +0000)
committerRobert Spalek <robert@ucw.cz>
Tue, 9 Nov 2004 17:48:52 +0000 (17:48 +0000)
runs properly so that we do not run a superfluous pass of sorting

lib/sorter.h

index 04243318d8ea876c87be35e02131d75320f4a6df..d8d9dc6d87b1353ebdceed76ee8bb7ddb31756c1 100644 (file)
@@ -531,11 +531,16 @@ struct fastbuf *fb1, struct fastbuf *fb2
     do P(pass)(&fb1, &fb2); while (fb1 && fb2);
 #else
     {
-      sh_off_t run_count = ~1LLU, max_run_count = 0;
+      sh_off_t run_count, max_run_count = 0;
       if (fb1)
        max_run_count += bfilesize(fb1);
       if (fb2)
        max_run_count += bfilesize(fb2);
+#ifdef SORT_PRESORT
+      run_count = max_run_count / sorter_presort_bufsize;
+#else
+      run_count = max_run_count;
+#endif
       if (SORT_UP_TO)
        max_run_count /= SORT_UP_TO;
       do