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:
parent
90890844ad
commit
ac7339877b
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue