X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Farraysort.h;h=b47fa8c38ac5287142608e50b7ea713f43da8994;hb=997624f88f37bec5cb96cf9fc3b3cac05ccc6ed8;hp=316bcd20edf5f196cf57724d4914bcb6a9828f06;hpb=c08795753ea2d9a9b12d857f7b22b69c757b66e1;p=libucw.git diff --git a/lib/arraysort.h b/lib/arraysort.h index 316bcd20..b47fa8c3 100644 --- a/lib/arraysort.h +++ b/lib/arraysort.h @@ -28,8 +28,10 @@ * ASORT_ELT(i) [*] returns the key of i-th element * ASORT_LT(x,y) x < y for ASORT_TYPE (default: "x ASORT_THRESHOLD && (right - l) > ASORT_THRESHOLD) + if ((r - left) >= ASORT_THRESHOLD && (right - l) >= ASORT_THRESHOLD) { /* Both partitions ok => push the larger one */ if ((r - left) > (right - l)) @@ -111,12 +117,12 @@ static void ASORT_PREFIX(sort)(uns array_size) } sp++; } - else if ((r - left) > ASORT_THRESHOLD) + else if ((r - left) >= ASORT_THRESHOLD) { /* Left partition OK, right undersize */ right = r; } - else if ((right - l) > ASORT_THRESHOLD) + else if ((right - l) >= ASORT_THRESHOLD) { /* Right partition OK, left undersize */ left = l; @@ -160,8 +166,9 @@ static void ASORT_PREFIX(sort)(uns array_size) } #undef ASORT_PREFIX -#undef ASORT_TYPE +#undef ASORT_KEY_TYPE #undef ASORT_ELT -#undef ASORT_EQ +#undef ASORT_LT #undef ASORT_SWAP #undef ASORT_THRESHOLD +#undef ASORT_EXTRA_ARGS