[common] runningavg: avoid integer overflows

We receive values as int64_t, but when we compute the sum, we store it as
int. This doesn't make sense as we eventually cast it to double when
computing the average. We should instead store the sum as int64_t.
This commit is contained in:
Quantum 2021-06-28 00:22:25 -04:00 committed by Geoffrey McRae
parent 6419279c3c
commit d385b49f5f

View File

@ -26,7 +26,7 @@ struct RunningAvg
{
int length, samples;
int pos;
int value;
int64_t value;
int64_t values[0];
};