From 63405ab723eada97a195ed1964ca3af78aa5d7da Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 21 Nov 2023 15:48:28 -0800 Subject: til_util: fix til_get_ncpus() windows builds Prior to eb13ccdb (use sysconf on *nix) this #ifdef bug went unnoticed because the non-MACH code still compiled successfully on windows, just never got executed because the windows block returns. But after eb13ccdb the sysconf stuff needs defines not present for windows and things won't build, uncovering this silliness. Now only build the windows code on windows, and the non-win code everywhere else... with MACH being a special case of the everywhere else default. --- src/til_util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/til_util.c b/src/til_util.c index 7c44d67..d2e5b92 100644 --- a/src/til_util.c +++ b/src/til_util.c @@ -25,9 +25,8 @@ unsigned til_get_ncpus(void) GetSystemInfo(&sysinfo); return MIN(sysinfo.dwNumberOfProcessors, TIL_MAXCPUS); -#endif - -#ifdef __MACH__ +#else + #ifdef __MACH__ int count; size_t count_len = sizeof(count); @@ -35,7 +34,7 @@ unsigned til_get_ncpus(void) return 1; return MIN(count, TIL_MAXCPUS); -#else + #else long n; n = sysconf(_SC_NPROCESSORS_ONLN); @@ -43,5 +42,6 @@ unsigned til_get_ncpus(void) return 1; return MIN(n, TIL_MAXCPUS); + #endif #endif } -- cgit v1.2.1