From: Robert Spalek Date: Tue, 9 Nov 2004 17:48:52 +0000 (+0000) Subject: if SORT_PRESORT and SORT_UP_TO are both on, compute the initial number of X-Git-Tag: holmes-import~873 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=e955686d48e66e1a5ca00d66f6e5846ab0c92118;p=libucw.git if SORT_PRESORT and SORT_UP_TO are both on, compute the initial number of runs properly so that we do not run a superfluous pass of sorting --- diff --git a/lib/sorter.h b/lib/sorter.h index 04243318..d8d9dc6d 100644 --- a/lib/sorter.h +++ b/lib/sorter.h @@ -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