diff options
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/threading/cpu.c | 13 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3113e0..80a59bb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,8 +6,7 @@ add_subdirectory(vdf) add_subdirectory(threading) set(CFLAGS - -Wall -Wextra -pedantic - -Wfloat-equal -Wundef + -Wall -Wextra -pedantic -Wfloat-equal -Wstrict-overflow=5 -Wunreachable-code -Wcast-qual -Wswitch-default -Wconversion -Wshadow -Wstrict-aliasing diff --git a/src/threading/cpu.c b/src/threading/cpu.c index 45671df..381abeb 100644 --- a/src/threading/cpu.c +++ b/src/threading/cpu.c @@ -1,6 +1,17 @@ +#ifdef _WIN32 +#include <windows.h> +#else #include <sys/sysinfo.h> +#endif int get_core_count() { - return get_nprocs(); +#ifdef _WIN32 + SYSTEM_INFO sysinfo; + GetSystemInfo( &sysinfo ); + + return sysinfo.dwNumberOfProcessors; +#else + return get_nprocs(); +#endif } |