summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/parallel
diff options
context:
space:
mode:
authorsingler <singler@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-08 09:11:49 +0000
committersingler <singler@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-08 09:11:49 +0000
commit84098e25fabc160c0178602082dcfbe547f5bc8d (patch)
tree9129229778941484eeb985061e9bde666e88d58c /libstdc++-v3/include/parallel
parentba72912a012b97cad825eebee3f5f22253d0afe4 (diff)
downloadppe42-gcc-84098e25fabc160c0178602082dcfbe547f5bc8d.tar.gz
ppe42-gcc-84098e25fabc160c0178602082dcfbe547f5bc8d.zip
2010-06-08 Johannes Singler <singler@kit.edu>
* include/parallel/partial_sum.h (__parallel_partial_sum_linear): Correctly calculate part lengths for partial_sum_dilation!=1.0f. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160428 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/parallel')
-rw-r--r--libstdc++-v3/include/parallel/partial_sum.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/libstdc++-v3/include/parallel/partial_sum.h b/libstdc++-v3/include/parallel/partial_sum.h
index 966d9db0572..d398c4585a2 100644
--- a/libstdc++-v3/include/parallel/partial_sum.h
+++ b/libstdc++-v3/include/parallel/partial_sum.h
@@ -127,10 +127,13 @@ namespace __gnu_parallel
equally_split(__n, __num_threads + 1, __borders);
else
{
+ _DifferenceType __first_part_length =
+ std::max<_DifferenceType>(1,
+ __n / (1.0f + __s.partial_sum_dilation * __num_threads));
_DifferenceType __chunk_length =
- ((double)__n
- / ((double)__num_threads + __s.partial_sum_dilation)),
- __borderstart = __n - __num_threads * __chunk_length;
+ (__n - __first_part_length) / __num_threads;
+ _DifferenceType __borderstart =
+ __n - __num_threads * __chunk_length;
__borders[0] = 0;
for (_ThreadIndex __i = 1; __i < (__num_threads + 1); ++__i)
{
OpenPOWER on IntegriCloud