diff --git a/src/tools/OpenMP.h b/src/tools/OpenMP.h index 43d9442e86c83bce0bae66d4bfa176050bac86bd..202f7ca58a11c445225ff85201a8eb6fa5479237 100644 --- a/src/tools/OpenMP.h +++ b/src/tools/OpenMP.h @@ -55,7 +55,7 @@ unsigned OpenMP::getGoodNumThreads(const T*x,unsigned n) { (void) p; // this is not to have warnings. notice that the pointer location is not used actually. // a factor two is necessary since there is no guarantee that x is aligned // to cache line boundary - unsigned m=n/(2*getCachelineSize()*sizeof(T)); + unsigned m=n*sizeof(T)/(2*getCachelineSize()); unsigned numThreads=getNumThreads(); if(m>numThreads) m=numThreads; if(m==0) m=1;