diff options
author | 2019-03-26 11:13:37 +1100 | |
---|---|---|
committer | 2019-03-26 11:13:37 +1100 | |
commit | 97b67170277437131adf6ed4d60139c172529e4f (patch) | |
tree | 7a5cbf608f191075f1612b1af15832c206a3fe2d /src/lib/netlist/plib/pomp.h | |
parent | b380514764cf857469bae61c11143a19f79a74c5 (diff) |
(nw) Clean up the mess on master
This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and
c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at
598cd5227223c3b04ca31f0dbc1981256d9ea3ff.
Before pushing, please check that what you're about to push is sane.
Check your local commit log and ensure there isn't anything out-of-place
before pushing to mainline. When things like this happen, it wastes
everyone's time. I really don't need this in a week when real work⢠is
busting my balls and I'm behind where I want to be with preparing for
MAME release.
Diffstat (limited to 'src/lib/netlist/plib/pomp.h')
-rw-r--r-- | src/lib/netlist/plib/pomp.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/lib/netlist/plib/pomp.h b/src/lib/netlist/plib/pomp.h index 6559207f09d..f8a516df485 100644 --- a/src/lib/netlist/plib/pomp.h +++ b/src/lib/netlist/plib/pomp.h @@ -11,6 +11,8 @@ #include "pconfig.h" +#include <cstddef> + #if HAS_OPENMP #include "omp.h" #endif @@ -18,29 +20,39 @@ namespace plib { namespace omp { -template <class T> -void for_static(const int start, const int end, const T &what) +template <typename I, class T> +void for_static(const I start, const I end, const T &what) { #if HAS_OPENMP && USE_OPENMP #pragma omp parallel #endif { #if HAS_OPENMP && USE_OPENMP - #pragma omp for schedule(static) + #pragma omp for //schedule(static) #endif - for (int i = start; i < end; i++) + for (I i = start; i < end; i++) what(i); } } -inline void set_num_threads(const int threads) +template <typename I, class T> +void for_static_np(const I start, const I end, const T &what) +{ + for (I i = start; i < end; i++) + what(i); +} + + +inline void set_num_threads(const std::size_t threads) { #if HAS_OPENMP && USE_OPENMP omp_set_num_threads(threads); +#else + plib::unused_var(threads); #endif } -inline int get_max_threads() +inline std::size_t get_max_threads() { #if HAS_OPENMP && USE_OPENMP return omp_get_max_threads(); @@ -54,7 +66,7 @@ inline int get_max_threads() // pdynlib: dynamic loading of libraries ... // ---------------------------------------------------------------------------------------- -} -} +} // namespace omp +} // namespace plib #endif /* PSTRING_H_ */ |