Fix overflow issue with signed subtraction in float_sort

Also fix a problem with windows running tune.pl
This commit is contained in:
spreadsort
2023-04-20 19:09:34 -04:00
parent 6df06af708
commit 82ef138385
2 changed files with 4 additions and 4 deletions
@@ -410,7 +410,7 @@ namespace spreadsort {
max, min))
return;
unsigned log_divisor = get_log_divisor<float_log_mean_bin_size>(
last - first, rough_log_2_size(Size_type(max - min)));
last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1);
Div_type div_min = min >> log_divisor;
Div_type div_max = max >> log_divisor;
unsigned bin_count = unsigned(div_max - div_min) + 1;
@@ -507,7 +507,7 @@ namespace spreadsort {
if (is_sorted_or_find_extremes(first, last, max, min, rshift))
return;
unsigned log_divisor = get_log_divisor<float_log_mean_bin_size>(
last - first, rough_log_2_size(Size_type(max - min)));
last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1);
Div_type div_min = min >> log_divisor;
Div_type div_max = max >> log_divisor;
unsigned bin_count = unsigned(div_max - div_min) + 1;
@@ -605,7 +605,7 @@ namespace spreadsort {
if (is_sorted_or_find_extremes(first, last, max, min, rshift, comp))
return;
unsigned log_divisor = get_log_divisor<float_log_mean_bin_size>(
last - first, rough_log_2_size(Size_type(max - min)));
last - first, rough_log_2_size(Size_type(max/2 - min/2)) + 1);
Div_type div_min = min >> log_divisor;
Div_type div_max = max >> log_divisor;
unsigned bin_count = unsigned(div_max - div_min) + 1;
+1 -1
View File
@@ -19,7 +19,7 @@ $realtimes = 0;
$verifycorrect = 0;
$verbose = 0;
$exename = "spreadsort";
$makename = "../../b2 \-\-tune";
$makename = "b2 \-\-tune";
$all = "";
$iter_count = 1;
$debug = 0;