From 426dbf434b54f4ef4c40b1887bb13194c2caacbf Mon Sep 17 00:00:00 2001 From: koe Date: Fri, 13 Aug 2021 06:57:27 -0500 Subject: fix median overflow bug --- contrib/epee/include/stats.inl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'contrib') diff --git a/contrib/epee/include/stats.inl b/contrib/epee/include/stats.inl index 5a5cd0b93..70c127be7 100644 --- a/contrib/epee/include/stats.inl +++ b/contrib/epee/include/stats.inl @@ -1,6 +1,7 @@ #include #include #include +#include "misc_language.h" #include "stats.h" enum @@ -86,7 +87,7 @@ Tpod Stats::get_median() const } else { - median = (sorted[(sorted.size() - 1) / 2] + sorted[sorted.size() / 2]) / 2; + median = epee::misc_utils::get_mid(sorted[(sorted.size() - 1) / 2], sorted[sorted.size() / 2]); } set_cached(bit_median); } -- cgit v1.2.3