add typecast to avoid (unlikely but possible) integer overflows.

this will silence a lot of static code analysis warnings
This commit is contained in:
Axel Kohlmeyer
2021-02-02 17:27:04 -05:00
parent 5196926c28
commit e2e6639013
155 changed files with 566 additions and 576 deletions

View File

@ -554,14 +554,14 @@ void AtomVecBody::data_body(int m, int ninteger, int ndouble,
double AtomVecBody::memory_usage_bonus()
{
double bytes = 0;
bytes += nmax_bonus*sizeof(Bonus);
bytes += (double)nmax_bonus*sizeof(Bonus);
bytes += icp->size() + dcp->size();
int nall = nlocal_bonus + nghost_bonus;
for (int i = 0; i < nall; i++) {
if (body[i] >= 0) {
bytes += bonus[body[i]].ninteger * sizeof(int);
bytes += bonus[body[i]].ndouble * sizeof(double);
bytes += (double)bonus[body[i]].ninteger * sizeof(int);
bytes += (double)bonus[body[i]].ndouble * sizeof(double);
}
}