From dc2d61eb0eb1071e1b814c32f3db5f43cf3ed5bf Mon Sep 17 00:00:00 2001
From: carlocamilloni <carlo.camilloni@gmail.com>
Date: Sat, 13 Oct 2018 16:02:17 +0200
Subject: [PATCH] OpenMP: fix for getGoodNumThread @giovannibussi right?

---
 src/tools/OpenMP.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/OpenMP.h b/src/tools/OpenMP.h
index 43d9442e8..202f7ca58 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;
-- 
GitLab