diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-09 19:13:32 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-09 19:13:32 +0100 |
| commit | 1a37f4eb0cc792783784fca216c79e3f02a3234e (patch) | |
| tree | f55fb0d0dc7b8416204e3d483c49a178e7fcf1a4 | |
| parent | 454ad1f4b82abd781e44bf10e149d8f1ea468a79 (diff) | |
Only count bits in touched array members.new_os
| -rw-r--r-- | core/os/process_linux.odin | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/os/process_linux.odin b/core/os/process_linux.odin index 1d14c4b1f..7041e16b7 100644 --- a/core/os/process_linux.odin +++ b/core/os/process_linux.odin @@ -59,9 +59,8 @@ _get_current_thread_id :: proc "contextless" () -> int { @(private="package") _get_processor_core_count :: proc() -> (core_count: int) { cpu_set: [128]u64 - - if _, err := linux.sched_getaffinity(0, size_of(cpu_set), &cpu_set); err == nil { - for set in cpu_set { + if n, err := linux.sched_getaffinity(0, size_of(cpu_set), &cpu_set); err == nil { + for set in cpu_set[:n / 8] { core_count += int(intrinsics.count_ones(set)) } } |