mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[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:
parent
6419279c3c
commit
d385b49f5f
@ -26,7 +26,7 @@ struct RunningAvg
|
||||
{
|
||||
int length, samples;
|
||||
int pos;
|
||||
int value;
|
||||
int64_t value;
|
||||
int64_t values[0];
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user