1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-30 22:23:13 +03:00

Only set numPhysicalCores if ratio is valid

This commit is contained in:
Paul Bone
2021-03-02 20:31:23 +11:00
committed by Paul Bone
parent eb1a09df61
commit 4d6c78fb89

View File

@ -1212,11 +1212,13 @@ int UTIL_countPhysicalCores(void)
/* fall back on the sysconf value */
goto failed;
} }
if (siblings && cpu_cores) {
if (siblings && cpu_cores && siblings > cpu_cores) {
ratio = siblings / cpu_cores;
}
numPhysicalCores = numPhysicalCores / ratio;
if (ratio && numPhysicalCores > ratio) {
numPhysicalCores = numPhysicalCores / ratio;
}
failed:
fclose(cpuinfo);