From ad1e7bd3ce00544f86c254fde1f3db20fefa089f Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Thu, 4 Jun 2026 11:08:15 +0200 Subject: [PATCH] keep more generic cpu_count() for non Linux systems --- run-test262.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/run-test262.c b/run-test262.c index 8e2a7e7..81811b5 100644 --- a/run-test262.c +++ b/run-test262.c @@ -151,7 +151,7 @@ static int cpu_count(void) count += 1 & (procmask >> i); return count; } -#else +#elif defined(__linux__) /* return the number of available physical cores or -1 if not available */ static int get_cpu_info_physical_cores(void) { @@ -215,7 +215,12 @@ static int cpu_count(void) n = 1; return n; } -#endif /* !_WIN32 */ +#else /* __linux__ */ +static int cpu_count(void) +{ + return sysconf(_SC_NPROCESSORS_ONLN); +} +#endif /* !__linux__ */ static void init_thread_local_storage(ThreadLocalStorage *tls) {