32#ifndef _GLIBCXX_PARALLEL_BASE_H
33#define _GLIBCXX_PARALLEL_BASE_H 1
48namespace 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; }
156 template<
typename _T1,
typename _T2,
typename _Compare>
165 bool operator()(
const _T1& __a,
const _T2& __b)
166 {
return !_M_comp(__a, __b) && !_M_comp(__b, __a); }
172 template<
typename _Predicate,
typename argument_type>
185 {
return !_M_pred(__x); }
190 template<
typename _Operation,
typename _FirstArgumentType,
191 typename _SecondArgumentType,
typename _ResultType>
197 _FirstArgumentType _M_value;
200 __binder1st(
const _Operation& __x,
const _FirstArgumentType& __y)
201 : _M_op(__x), _M_value(__y) { }
204 operator()(
const _SecondArgumentType& __x)
205 {
return _M_op(_M_value, __x); }
210 operator()(_SecondArgumentType& __x)
const
211 {
return _M_op(_M_value, __x); }
218 template<
typename _Operation,
typename _FirstArgumentType,
219 typename _SecondArgumentType,
typename _ResultType>
225 _SecondArgumentType _M_value;
228 __binder2nd(
const _Operation& __x,
const _SecondArgumentType& __y)
229 : _M_op(__x), _M_value(__y) { }
232 operator()(
const _FirstArgumentType& __x)
const
233 {
return _M_op(__x, _M_value); }
238 operator()(_FirstArgumentType& __x)
239 {
return _M_op(__x, _M_value); }
243 template<
typename _T1,
typename _T2>
246 bool operator()(
const _T1& __t1,
const _T2& __t2)
const
247 {
return __t1 == __t2; }
251 template<
typename _T1,
typename _T2>
255 operator()(
const _T1& __t1,
const _T2& __t2)
const
256 {
return __t1 < __t2; }
259 operator()(
const _T2& __t2,
const _T1& __t1)
const
260 {
return __t2 < __t1; }
264 template<
typename _Tp>
265 struct _Less<_Tp, _Tp>
269 template<
typename _Tp1,
typename _Tp2,
typename _Result
270 = __typeof__(*
static_cast<_Tp1*
>(0)
271 + *
static_cast<_Tp2*
>(0))>
275 operator()(
const _Tp1& __x,
const _Tp2& __y)
const
276 {
return __x + __y; }
280 template<
typename _Tp>
281 struct _Plus<_Tp, _Tp, _Tp>
285 template<
typename _Tp1,
typename _Tp2,
typename _Result
286 = __typeof__(*
static_cast<_Tp1*
>(0)
287 * *
static_cast<_Tp2*
>(0))>
291 operator()(
const _Tp1& __x,
const _Tp2& __y)
const
292 {
return __x * __y; }
296 template<
typename _Tp>
305 template<
typename _Tp,
typename _DifferenceTp>
309 typedef _DifferenceTp _DifferenceType;
312 : _M_val(__val), _M_pos(__pos) { }
332 operator[](_DifferenceType)
const
337 {
return _M_pos == __i2._M_pos; }
341 {
return _M_pos != __i2._M_pos; }
345 {
return _M_pos - __i2._M_pos; }
349 _DifferenceType _M_pos;
358 template<
typename _Tp,
typename _DifferenceTp>
362 typedef _DifferenceTp _DifferenceType;
372 : _M_val(__val), _M_count(__count) { }
382 {
return iterator(_M_val, _M_count); }
386 _DifferenceType _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#if _GLIBCXX_PARALLEL_ASSERTIONS && defined(__glibcxx_assert_impl)
423# define _GLIBCXX_PARALLEL_ASSERT(_Condition) \
424 do { __glibcxx_assert_impl(_Condition); } while (false)
426# define _GLIBCXX_PARALLEL_ASSERT(_Condition) do { } while (false)
Includes the original header files concerned with iterators except for stream iterators....
Defines on whether to include algorithm variants.
End-user include file. Provides advanced settings and tuning options. This file is a GNU parallel ext...
ISO C++ entities toplevel namespace is std.
GNU parallel code, replaces standard behavior with parallel behavior.
GNU parallel code for public use.
uint16_t _ThreadIndex
Unsigned integer to index a thread number. The maximum thread number (for each processor) must fit in...
const _Tp & max(const _Tp &__a, const _Tp &__b)
Equivalent to std::max.
const _Tp & min(const _Tp &__a, const _Tp &__b)
Equivalent to std::min.
_RAIter __median_of_three_iterators(_RAIter __a, _RAIter __b, _RAIter __c, _Compare __comp)
Compute the median of three referenced elements, according to __comp.
_Parallelism
Run-time equivalents for the compile-time tags.
@ sequential
Not parallel.
_CASable __encode2(int __a, int __b)
Encode two integers into one gnu_parallel::_CASable.
int64_t _CASable
Longest compare-and-swappable integer type on this platform.
static const _CASable _CASable_mask
_CASable with the right half of bits set to 1.
static const int _CASable_bits
Number of bits of _CASable.
_Size __rd_log2(_Size __n)
Calculates the rounded-down logarithm of __n for base 2.
void __decode2(_CASable __x, int &__a, int &__b)
Decode two integers from one gnu_parallel::_CASable.
GNU sequential classes for public use.
argument_type argument_type
argument_type is the type of the argument
One of the math functors.
One of the math functors.
One of the comparison functors.
Constructs predicate for equality from strict weak ordering predicate.
Similar to std::unary_negate, but giving the argument types explicitly.
Similar to std::binder1st, but giving the argument types explicitly.
Similar to std::binder2nd, but giving the argument types explicitly.
Similar to std::equal_to, but allows two different types.
Similar to std::less, but allows two different types.
Similar to std::plus, but allows two different types.
Similar to std::multiplies, but allows two different types.
_Iterator associated with __gnu_parallel::_PseudoSequence. If features the usual random-access iterat...
Sequence that conceptually consists of multiple copies of the same element. The copies are not stored...
iterator begin() const
Begin iterator.
iterator end() const
End iterator.
_PseudoSequence(const _Tp &__val, _DifferenceType __count)
Constructor.