32 #ifndef _GLIBCXX_PARALLEL_BASE_H 33 #define _GLIBCXX_PARALLEL_BASE_H 1 48 namespace std _GLIBCXX_VISIBILITY(default)
50 namespace __parallel { }
70 #ifdef _GLIBCXX_PARALLEL 71 using namespace std::_GLIBCXX_STD_A;
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; }
153 #pragma GCC diagnostic push 154 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" // *nary_function 159 template<
typename _T1,
typename _T2,
typename _Compare>
168 bool operator()(
const _T1& __a,
const _T2& __b)
169 {
return !_M_comp(__a, __b) && !_M_comp(__b, __a); }
174 template<
typename _Predicate,
typename argument_type>
187 {
return !_M_pred(__x); }
192 template<
typename _Operation,
typename _FirstArgumentType,
193 typename _SecondArgumentType,
typename _ResultType>
199 _FirstArgumentType _M_value;
202 __binder1st(
const _Operation& __x,
const _FirstArgumentType& __y)
203 : _M_op(__x), _M_value(__y) { }
206 operator()(
const _SecondArgumentType& __x)
207 {
return _M_op(_M_value, __x); }
212 operator()(_SecondArgumentType& __x)
const 213 {
return _M_op(_M_value, __x); }
220 template<
typename _Operation,
typename _FirstArgumentType,
221 typename _SecondArgumentType,
typename _ResultType>
227 _SecondArgumentType _M_value;
230 __binder2nd(
const _Operation& __x,
const _SecondArgumentType& __y)
231 : _M_op(__x), _M_value(__y) { }
234 operator()(
const _FirstArgumentType& __x)
const 235 {
return _M_op(__x, _M_value); }
240 operator()(_FirstArgumentType& __x)
241 {
return _M_op(__x, _M_value); }
245 template<
typename _T1,
typename _T2>
248 bool operator()(
const _T1& __t1,
const _T2& __t2)
const 249 {
return __t1 == __t2; }
253 template<
typename _T1,
typename _T2>
257 operator()(
const _T1& __t1,
const _T2& __t2)
const 258 {
return __t1 < __t2; }
261 operator()(
const _T2& __t2,
const _T1& __t1)
const 262 {
return __t2 < __t1; }
266 template<
typename _Tp>
267 struct _Less<_Tp, _Tp>
271 template<
typename _Tp1,
typename _Tp2,
typename _Result
272 = __typeof__(*static_cast<_Tp1*>(0)
273 + *static_cast<_Tp2*>(0))>
277 operator()(
const _Tp1& __x,
const _Tp2& __y)
const 278 {
return __x + __y; }
282 template<
typename _Tp>
283 struct _Plus<_Tp, _Tp, _Tp>
287 template<
typename _Tp1,
typename _Tp2,
typename _Result
288 = __typeof__(*static_cast<_Tp1*>(0)
289 * *static_cast<_Tp2*>(0))>
293 operator()(
const _Tp1& __x,
const _Tp2& __y)
const 294 {
return __x * __y; }
298 template<
typename _Tp>
302 #pragma GCC diagnostic pop // -Wdeprecated-declarations 309 template<
typename _Tp,
typename _DifferenceTp>
313 typedef _DifferenceTp _DifferenceType;
316 : _M_val(__val), _M_pos(__pos) { }
336 operator[](_DifferenceType)
const 341 {
return _M_pos == __i2._M_pos; }
345 {
return _M_pos != __i2._M_pos; }
349 {
return _M_pos - __i2._M_pos; }
353 _DifferenceType _M_pos;
362 template<
typename _Tp,
typename _DifferenceTp>
366 typedef _DifferenceTp _DifferenceType;
376 : _M_val(__val), _M_count(__count) { }
386 {
return iterator(_M_val, _M_count); }
390 _DifferenceType _M_count;
400 template<
typename _RAIter,
typename _Compare>
403 _RAIter __c, _Compare __comp)
405 if (__comp(*__a, *__b))
406 if (__comp(*__b, *__c))
409 if (__comp(*__a, *__c))
416 if (__comp(*__a, *__c))
419 if (__comp(*__b, *__c))
426 #if _GLIBCXX_PARALLEL_ASSERTIONS && defined(__glibcxx_assert_impl) 427 # define _GLIBCXX_PARALLEL_ASSERT(_Condition) \ 428 do { __glibcxx_assert_impl(_Condition); } while (false) 430 # define _GLIBCXX_PARALLEL_ASSERT(_Condition) do { } while (false)
Similar to std::equal_to, but allows two different types.
uint16_t _ThreadIndex
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
Similar to std::unary_negate, but giving the argument types explicitly.
iterator begin() const
Begin iterator.
iterator end() const
End iterator.
Similar to std::multiplies, but allows two different types.
constexpr complex< _Tp > operator*(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x times y.
argument_type argument_type
argument_type is the type of the argument
_Parallelism
Run-time equivalents for the compile-time tags.
Includes the original header files concerned with iterators except for stream iterators. This file is a GNU parallel extension to the Standard C++ Library.
const _Tp & min(const _Tp &__a, const _Tp &__b)
Equivalent to std::min.
_Iterator associated with __gnu_parallel::_PseudoSequence. If features the usual random-access iterat...
Similar to std::binder2nd, but giving the argument types explicitly.
GNU parallel code for public use.
Constructs predicate for equality from strict weak ordering predicate.
_PseudoSequence(const _Tp &__val, _DifferenceType __count)
Constructor.
constexpr complex< _Tp > operator-(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x minus y.
int64_t _CASable
Longest compare-and-swappable integer type on this platform.
One of the math functors.
static const int _CASable_bits
Number of bits of _CASable.
Similar to std::less, but allows two different types.
End-user include file. Provides advanced settings and tuning options. This file is a GNU parallel ext...
Similar to std::binder1st, but giving the argument types explicitly.
_CASable __encode2(int __a, int __b)
Encode two integers into one gnu_parallel::_CASable.
GNU parallel code, replaces standard behavior with parallel behavior.
Similar to std::plus, but allows two different types.
_RAIter __median_of_three_iterators(_RAIter __a, _RAIter __b, _RAIter __c, _Compare __comp)
Compute the median of three referenced elements, according to __comp.
_Size __rd_log2(_Size __n)
Calculates the rounded-down logarithm of __n for base 2.
Sequence that conceptually consists of multiple copies of the same element. The copies are not stored...
ISO C++ entities toplevel namespace is std.
Defines on whether to include algorithm variants.
One of the comparison functors.
void __decode2(_CASable __x, int &__a, int &__b)
Decode two integers from one gnu_parallel::_CASable.
static const _CASable _CASable_mask
_CASable with the right half of bits set to 1.
const _Tp & max(const _Tp &__a, const _Tp &__b)
Equivalent to std::max.
One of the math functors.
GNU sequential classes for public use.