From ac7339877b3e083b5dd93f34ec79779d43f784ae Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Mon, 31 Oct 2011 20:03:30 +0100 Subject: [PATCH 1/1] Fix compile error in cpu_count() The std::min() template function requires both arguments to be of the same type. But here we have the integer MAX_THREADS compared to a long: long sysconf(int name); So cast to integer and fix the compile. No functional change. Signed-off-by: Marco Costalba --- src/misc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/misc.cpp b/src/misc.cpp index 10c779ed..0920f7f0 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -161,12 +161,12 @@ int cpu_count() { #else # if defined(_SC_NPROCESSORS_ONLN) - return std::min(sysconf(_SC_NPROCESSORS_ONLN), MAX_THREADS); + return std::min((int)sysconf(_SC_NPROCESSORS_ONLN), MAX_THREADS); # elif defined(__hpux) struct pst_dynamic psd; if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) == -1) return 1; - return std::min(psd.psd_proc_cnt, MAX_THREADS); + return std::min((int)psd.psd_proc_cnt, MAX_THREADS); # else return 1; # endif -- 2.39.2