mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 14:21:57 +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
1 changed files with 1 additions and 1 deletions
|
@ -26,7 +26,7 @@ struct RunningAvg
|
||||||
{
|
{
|
||||||
int length, samples;
|
int length, samples;
|
||||||
int pos;
|
int pos;
|
||||||
int value;
|
int64_t value;
|
||||||
int64_t values[0];
|
int64_t values[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue