* include/parallel/base.h (__gnu_parallel::less<Tp>): Add partial
specialization for one argument.
(__gnu_parallel::less): Add operator.
* include/parallel/multiway_merge.h: Use __builtin_alloca.
* include/parallel/partial_sum.h: Same.
* include/parallel/find.h: Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128505
138bc75d-0d04-0410-961f-
82ee72b054a4
-2007-09-10 Jonathan Wakely <jwakely.gcc@gmail.com>
+2007-09-14 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/parallel/base.h (__gnu_parallel::less<Tp>): Add partial
+ specialization for one argument.
+ (__gnu_parallel::less): Add operator.
+
+ * include/parallel/multiway_merge.h: Use __builtin_alloca.
+ * include/parallel/partial_sum.h: Same.
+ * include/parallel/find.h: Same.
+
+2007-09-14 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/tr1_impl/boost_shared_ptr.h: (__weak_ptr::lock()): Add
missing template argument.
{ return op(value, __x); }
};
- /** @brief Similar to std::binder2nd, but giving the argument types explicitly. */
+ /**
+ * @brief Similar to std::binder2nd, but giving the argument types
+ * explicitly.
+ */
template<typename _Operation, typename first_argument_type, typename second_argument_type, typename result_type>
class binder2nd
: public std::unary_function<first_argument_type, result_type>
template<typename T1, typename T2>
struct less : std::binary_function<T1, T2, bool>
{
- bool operator()(const T1& t1, const T2& t2) const
+ bool
+ operator()(const T1& t1, const T2& t2) const
{ return t1 < t2; }
+
+ bool
+ operator()(const T2& t2, const T1& t1) const
+ { return t2 < t1; }
};
+ // Partial specialization for one type. Same as std::less.
+ template<typename _Tp>
+ struct less<_Tp, _Tp> : public std::binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x < __y; }
+ };
template<typename T, typename _DifferenceTp>
class pseudo_sequence;
public:
typedef _DifferenceTp difference_type;
- typedef pseudo_sequence_iterator<T, uint64> iterator; //better case down to uint64, than up to _DifferenceTp
+
+ // Better case down to uint64, than up to _DifferenceTp.
+ typedef pseudo_sequence_iterator<T, uint64> iterator;
/** @brief Constructor.
* @param val Element of the sequence.
const thread_index_t num_threads = get_max_threads();
- // XXX VLA error.
- difference_type borders[num_threads + 1];
+ difference_type* borders = static_cast<difference_type*>(__builtin_alloca(sizeof(difference_type) * (num_threads + 1)));
+
equally_split(length, num_threads, borders);
#pragma omp parallel shared(result) num_threads(num_threads)
copy(seqs_begin, seqs_end, se.begin());
- difference_type borders[num_threads + 1];
+ difference_type* borders = static_cast<difference_type*>(__builtin_alloca(sizeof(difference_type) * (num_threads + 1)));
equally_split(length, num_threads, borders);
for (int s = 0; s < (num_threads - 1); s++)
if (!tight)
{
offsets[num_threads - 1].resize(k);
- multiseq_partition(se.begin(), se.end(), (difference_type)length,
+ multiseq_partition(se.begin(), se.end(),
+ difference_type(length),
offsets[num_threads - 1].begin(), comp);
}
}
return parallel_partial_sum_basecase(begin + 1, end, result + 1, bin_op, *begin);
}
- difference_type* borders = __builtin_alloca(sizeof(difference_type) * (num_threads + 2));
+ difference_type* borders = static_cast<difference_type*>(__builtin_alloca(sizeof(difference_type) * (num_threads + 2)));
if (Settings::partial_sum_dilatation == 1.0f)
equally_split(n, num_threads + 1, borders);