1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

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 <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-10-31 20:03:30 +01:00
parent 90890844ad
commit ac7339877b

View file

@ -161,12 +161,12 @@ int cpu_count() {
#else #else
# if defined(_SC_NPROCESSORS_ONLN) # 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) # elif defined(__hpux)
struct pst_dynamic psd; struct pst_dynamic psd;
if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) == -1) if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) == -1)
return 1; return 1;
return std::min(psd.psd_proc_cnt, MAX_THREADS); return std::min((int)psd.psd_proc_cnt, MAX_THREADS);
# else # else
return 1; return 1;
# endif # endif