mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-27 15:52:28 +00:00
parent
335d158ab6
commit
ec6e0fa5f4
8 changed files with 93 additions and 10 deletions
|
@ -36,9 +36,8 @@
|
|||
static unsigned GetCpuCountLinux(void) {
|
||||
uint64_t s[16];
|
||||
unsigned i, c, n;
|
||||
if ((n = sched_getaffinity(0, sizeof(s), s)) > 0) {
|
||||
assert(!(n & 7));
|
||||
for (n >>= 3, c = i = 0; i < n; ++i) {
|
||||
if (!sched_getaffinity(0, sizeof(s), s)) {
|
||||
for (c = i = 0; i < ARRAYLEN(s); ++i) {
|
||||
c += popcnt(s[i]);
|
||||
}
|
||||
return c;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue