Merge branch 'pr-14'

This commit is contained in:
pete committed 2026-09-26 19:20:59 +01:00
commit ad29df2396
1 file changed
+3 -2
+3 -2
View File
@@ -49,11 +49,12 @@ std::vector<int> physical_cores(bool skip_first) {
#else
cpu_set_t set;
CPU_ZERO(&set);
if (sched_getaffinity(0, sizeof set, &set) == 0)
if (sched_getaffinity(0, sizeof set, &set) == 0) {
for (int i = 0; i < CPU_SETSIZE; ++i)
if (CPU_ISSET(i, &set)) cores.push_back(i);
else
} else {
for (unsigned i = 0; i < std::thread::hardware_concurrency(); ++i) cores.push_back((int) i);
}
#endif
if (skip_first && !cores.empty()) cores.erase(cores.begin());
return cores;