avoid integer overflow when computing memory usage

This commit is contained in:
Axel Kohlmeyer
2021-02-06 18:15:48 -05:00
parent 779bbd0853
commit 1609c498bc
5 changed files with 8 additions and 11 deletions

View File

@ -702,8 +702,8 @@ double FixAveCorrelateLong::memory_usage() {
// f: npair x numcorrelators x p
double bytes = (4*npair*numcorrelators*p + 2*npair*numcorrelators
+ numcorrelators*p)*sizeof(double)
+ numcorrelators*p*sizeof(unsigned long int)
+ 2*numcorrelators*sizeof(unsigned int);
+ (double)numcorrelators*p*sizeof(unsigned long int)
+ 2.0*numcorrelators*sizeof(unsigned int);
return bytes;
}