Clean up getPivot() a little.

This commit is contained in:
dsimcha 2011-06-08 22:36:29 -04:00
parent 0a40daaead
commit 174b705bd5

View file

@ -6285,6 +6285,10 @@ unittest
/*private*/
size_t getPivot(alias less, Range)(Range r)
{
// This algorithm sorts the first, middle and last elements of r,
// then returns the index of the middle element. In effect, it uses the
// median-of-three heuristic.
alias binaryFun!(less) pred;
immutable len = r.length;
immutable size_t mid = len / 2;
@ -6316,7 +6320,7 @@ size_t getPivot(alias less, Range)(Range r)
assert(0);
}
return len / 2;
return mid;
}
// @@@BUG1904