mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-06 02:34:00 +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:
@@ -26,7 +26,7 @@ struct RunningAvg
|
||||
{
|
||||
int length, samples;
|
||||
int pos;
|
||||
int value;
|
||||
int64_t value;
|
||||
int64_t values[0];
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user