32 #ifndef _GLIBCXX_PARALLEL_BASE_H
33 #define _GLIBCXX_PARALLEL_BASE_H 1
35 #include <bits/c++config.h>
50 namespace __parallel { }
57 namespace __gnu_parallel
60 using namespace std::__parallel;
67 namespace __gnu_sequential
70 #ifdef _GLIBCXX_PARALLEL
71 using namespace std::_GLIBCXX_STD_A;
78 namespace __gnu_parallel
88 return __i > 1 ? __i : 1;
100 template<
typename _Size>
105 for (__k = 0; __n > 1; __n >>= 1)
142 template<
typename _Tp>
144 min(
const _Tp& __a,
const _Tp& __b)
145 {
return (__a < __b) ? __a : __b; }
148 template<
typename _Tp>
150 max(
const _Tp& __a,
const _Tp& __b)
151 {
return (__a > __b) ? __a : __b; }
156 template<
typename _T1,
typename _T2,
typename _Compare>
166 {
return !_M_comp(__a, __b) && !_M_comp(__b, __a); }
172 template<
typename _Predicate,
typename argument_type>
174 :
public std::unary_function<argument_type, bool>
185 {
return !_M_pred(__x); }
190 template<
typename _Operation,
typename _FirstArgumentType,
191 typename _SecondArgumentType,
typename _ResultType>
193 :
public std::unary_function<_SecondArgumentType, _ResultType>
201 : _M_op(__x), _M_value(__y) { }
205 {
return _M_op(_M_value, __x); }
211 {
return _M_op(_M_value, __x); }
218 template<
typename _Operation,
typename _FirstArgumentType,
219 typename _SecondArgumentType,
typename _ResultType>
221 :
public std::unary_function<_FirstArgumentType, _ResultType>
228 __binder2nd(
const _Operation& __x,
const _SecondArgumentType& __y)
229 : _M_op(__x), _M_value(__y) { }
233 {
return _M_op(__x, _M_value); }
239 {
return _M_op(__x, _M_value); }
243 template<
typename _T1,
typename _T2>
244 struct _EqualTo : std::binary_function<_T1, _T2, bool>
247 {
return __t1 == __t2; }
251 template<
typename _T1,
typename _T2>
252 struct _Less : std::binary_function<_T1, _T2, bool>
256 {
return __t1 < __t2; }
260 {
return __t2 < __t1; }
264 template<
typename _Tp>
266 :
public std::less<_Tp> { };
269 template<
typename _Tp1,
typename _Tp2,
typename _Result
270 = __typeof__(*static_cast<_Tp1*>(0)
271 + *static_cast<_Tp2*>(0))>
272 struct _Plus :
public std::binary_function<_Tp1, _Tp2, _Result>
276 {
return __x + __y; }
280 template<
typename _Tp>
282 :
public std::plus<_Tp> { };
285 template<
typename _Tp1,
typename _Tp2,
typename _Result
286 = __typeof__(*static_cast<_Tp1*>(0)
287 * *static_cast<_Tp2*>(0))>
288 struct _Multiplies :
public std::binary_function<_Tp1, _Tp2, _Result>
292 {
return __x * __y; }
296 template<
typename _Tp>
298 :
public std::multiplies<_Tp> { };
305 template<
typename _Tp,
typename _DifferenceTp>
312 : _M_val(__val), _M_pos(__pos) { }
337 {
return _M_pos == __i2.
_M_pos; }
341 {
return _M_pos != __i2.
_M_pos; }
345 {
return _M_pos - __i2.
_M_pos; }
358 template<
typename _Tp,
typename _DifferenceTp>
372 : _M_val(__val), _M_count(__count) { }
382 {
return iterator(_M_val, _M_count); }
396 template<
typename _RAIter,
typename _Compare>
399 _RAIter __c, _Compare __comp)
401 if (__comp(*__a, *__b))
402 if (__comp(*__b, *__c))
405 if (__comp(*__a, *__c))
412 if (__comp(*__a, *__c))
415 if (__comp(*__b, *__c))
422 #define _GLIBCXX_PARALLEL_ASSERT(_Condition) __glibcxx_assert(_Condition)
_Result operator()(const _Tp1 &__x, const _Tp2 &__y) const
Definition: base.h:291
_CASable __encode2(int __a, int __b)
Encode two integers into one gnu_parallel::_CASable.
Definition: base.h:119
__binder1st(const _Operation &__x, const _FirstArgumentType &__y)
Definition: base.h:200
_Predicate _M_pred
Definition: base.h:177
bool operator()(const argument_type &__x)
Definition: base.h:184
Similar to std::multiplies, but allows two different types.
Definition: base.h:288
uint16_t _ThreadIndex
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
Definition: types.h:123
Similar to std::unary_negate, but giving the argument types explicitly.
Definition: base.h:173
_Operation _M_op
Definition: base.h:224
_PseudoSequenceIterator< _Tp, uint64_t > iterator
Definition: base.h:365
const _Tp & operator[](_DifferenceType) const
Definition: base.h:332
_Operation _M_op
Definition: base.h:196
_DifferenceType _M_pos
Definition: base.h:349
_DifferenceType operator-(const _PseudoSequenceIterator &__i2)
Definition: base.h:344
__unary_negate(const _Predicate &__x)
Definition: base.h:181
_SecondArgumentType _M_value
Definition: base.h:225
bool operator()(const _T1 &__t1, const _T2 &__t2) const
Definition: base.h:246
const _Tp & operator*() const
Definition: base.h:328
_PseudoSequence(const _Tp &__val, _DifferenceType __count)
Constructor.
Definition: base.h:371
_RAIter __median_of_three_iterators(_RAIter __a, _RAIter __b, _RAIter __c, _Compare __comp)
Compute the median of three referenced elements, according to __comp.
Definition: base.h:398
static const _CASable _CASable_mask
_CASable with the right half of bits set to 1.
Definition: types.h:133
void __decode2(_CASable __x, int &__a, int &__b)
Decode two integers from one gnu_parallel::_CASable.
Definition: base.h:133
_Parallelism
Run-time equivalents for the compile-time tags.
Definition: types.h:44
const _Tp & min(const _Tp &__a, const _Tp &__b)
Equivalent to std::min.
Definition: base.h:144
Not parallel.
Definition: types.h:47
bool __is_parallel(const _Parallelism __p)
Definition: base.h:93
bool operator()(const _T2 &__t2, const _T1 &__t1) const
Definition: base.h:259
Similar to std::equal_to, but allows two different types.
Definition: base.h:244
int omp_get_max_threads(void) __GOMP_NOTHROW
_DifferenceTp _DifferenceType
Definition: base.h:362
End-user include file. Provides advanced settings and tuning options. This file is a GNU parallel ext...
bool operator!=(const _PseudoSequenceIterator &__i2)
Definition: base.h:340
bool operator()(const _T1 &__a, const _T2 &__b)
Definition: base.h:165
_Result operator()(const _Tp1 &__x, const _Tp2 &__y) const
Definition: base.h:275
Includes the original header files concerned with iterators except for stream iterators. This file is a GNU parallel extension to the Standard C++ Library.
bool operator()(const _T1 &__t1, const _T2 &__t2) const
Definition: base.h:255
_Size __rd_log2(_Size __n)
Calculates the rounded-down logarithm of __n for base 2.
Definition: base.h:102
_ResultType operator()(const _SecondArgumentType &__x)
Definition: base.h:204
_ResultType operator()(_FirstArgumentType &__x)
Definition: base.h:238
_DifferenceTp _DifferenceType
Definition: base.h:309
__binder2nd(const _Operation &__x, const _SecondArgumentType &__y)
Definition: base.h:228
Similar to std::binder2nd, but giving the argument types explicitly.
Definition: base.h:220
_EqualFromLess(_Compare &__comp)
Definition: base.h:163
const _Tp & max(const _Tp &__a, const _Tp &__b)
Equivalent to std::max.
Definition: base.h:150
Sequence that conceptually consists of multiple copies of the same element. The copies are not stored...
Definition: base.h:359
iterator begin() const
Begin iterator.
Definition: base.h:376
const _Tp & _M_val
Definition: base.h:348
_ResultType operator()(const _FirstArgumentType &__x) const
Definition: base.h:232
const _Tp & _M_val
Definition: base.h:385
namespace std _GLIBCXX_VISIBILITY(default)
Definition: base.h:48
iterator end() const
End iterator.
Definition: base.h:381
_PseudoSequenceIterator & operator++()
Definition: base.h:316
_DifferenceType _M_count
Definition: base.h:386
_Iterator associated with __gnu_parallel::_PseudoSequence. If features the usual random-access iterat...
Definition: base.h:306
_Compare & _M_comp
Definition: base.h:160
Constructs predicate for equality from strict weak ordering predicate.
Definition: base.h:157
_ThreadIndex __get_max_threads()
Definition: base.h:85
bool operator==(const _PseudoSequenceIterator &__i2)
Definition: base.h:336
Similar to std::plus, but allows two different types.
Definition: base.h:272
_PseudoSequenceIterator operator++(int)
Definition: base.h:324
static const int _CASable_bits
Number of bits of _CASable.
Definition: types.h:130
Defines on whether to include algorithm variants.
_PseudoSequenceIterator(const _Tp &__val, _DifferenceType __pos)
Definition: base.h:311
Similar to std::binder1st, but giving the argument types explicitly.
Definition: base.h:192
Similar to std::less, but allows two different types.
Definition: base.h:252
_ResultType operator()(_SecondArgumentType &__x) const
Definition: base.h:210
int64_t _CASable
Longest compare-and-swappable integer type on this platform.
Definition: types.h:127
_FirstArgumentType _M_value
Definition: base.h:197