Round the number of threads to use down to a power of 2

Since other calculations depend on this being true
This commit is contained in:
Eric Fischer
2015-12-22 10:33:08 -08:00
parent fee18cc31e
commit edd325e338
+3
View File
@@ -70,6 +70,9 @@ void init_cpus() {
CPUS = 1; CPUS = 1;
} }
// Round down to a power of 2
CPUS = 1 << (int) (log(CPUS) / log(2));
TEMP_FILES = 64; TEMP_FILES = 64;
struct rlimit rl; struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { if (getrlimit(RLIMIT_NOFILE, &rl) != 0) {