add typecast to avoid (unlikely but possible) integer overflows.
this will silence a lot of static code analysis warnings
This commit is contained in:
@ -597,6 +597,6 @@ int FixOrientBCC::compare(const void *pi, const void *pj)
|
||||
double FixOrientBCC::memory_usage()
|
||||
{
|
||||
double bytes = nmax * sizeof(Nbr);
|
||||
bytes += 2*nmax * sizeof(double);
|
||||
bytes += (double)2*nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -595,6 +595,6 @@ int FixOrientFCC::compare(const void *pi, const void *pj)
|
||||
double FixOrientFCC::memory_usage()
|
||||
{
|
||||
double bytes = nmax * sizeof(Nbr);
|
||||
bytes += 2*nmax * sizeof(double);
|
||||
bytes += (double)2*nmax * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -558,8 +558,8 @@ void FixTTM::end_of_step()
|
||||
double FixTTM::memory_usage()
|
||||
{
|
||||
double bytes = 0.0;
|
||||
bytes += 5*total_nnodes * sizeof(int);
|
||||
bytes += 14*total_nnodes * sizeof(double);
|
||||
bytes += (double)5*total_nnodes * sizeof(int);
|
||||
bytes += (double)14*total_nnodes * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user