summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 35395a7c..d405a991 100644
--- a/lib.c
+++ b/lib.c
@@ -3578,7 +3578,7 @@ static void swap(val vec, val i, val j)
static void quicksort(val vec, val lessfun, val keyfun, cnum from, cnum to)
{
if (to - from >= 2) {
- cnum pivot = (to - from) / 2;
+ cnum pivot = to + (to - from) / 2;
cnum i, j;
val pval = ref(vec, num_fast(pivot));
val pkval = funcall1(keyfun, pval);