From 9c1f2b2123b95125caeda5f44ba461dbfa3993ab Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Fri, 17 Feb 2017 14:14:55 -0800 Subject: [PATCH] Guard against potentially rounding to 0 when choosing sorting unit --- main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.cpp b/main.cpp index 30cc4a7..03f1b0d 100644 --- a/main.cpp +++ b/main.cpp @@ -708,6 +708,9 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split unit = max_unit; } unit = ((unit + page - 1) / page) * page; + if (unit < page) { + unit = page; + } size_t nmerges = (indexpos + unit - 1) / unit; struct mergelist merges[nmerges];