fix median overflow bug

pull/7997/head
koe 3 years ago committed by selsta
parent 908ecb3cee
commit 945665ff70
Signed by untrusted user: selsta
GPG Key ID: 2EA0A99A8B07AE5E

@ -1,6 +1,7 @@
#include <math.h>
#include <limits>
#include <algorithm>
#include "misc_language.h"
#include "stats.h"
enum
@ -86,7 +87,7 @@ Tpod Stats<T, Tpod>::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);
}

Loading…
Cancel
Save