Skip to content
Snippets Groups Projects
Commit d385b49f authored by Quantum's avatar Quantum Committed by Geoffrey McRae
Browse files

[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.
parent 6419279c
Branches
Tags
No related merge requests found
......@@ -26,7 +26,7 @@ struct RunningAvg
{
int length, samples;
int pos;
int value;
int64_t value;
int64_t values[0];
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment