]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2010-06-08 Johannes Singler <singler@kit.edu>
authorJohannes Singler <singler@kit.edu>
Tue, 8 Jun 2010 09:11:49 +0000 (09:11 +0000)
committerJohannes Singler <singler@gcc.gnu.org>
Tue, 8 Jun 2010 09:11:49 +0000 (09:11 +0000)
        * include/parallel/partial_sum.h
        (__parallel_partial_sum_linear):
        Correctly calculate part lengths for partial_sum_dilation!=1.0f.

From-SVN: r160428

libstdc++-v3/ChangeLog
libstdc++-v3/include/parallel/partial_sum.h

index 0f24ab4f6e7cd7f87d6c2e4ce2d2428acfbe3e2f..3ebfd13bac37e739ad6cb4154e68552d1efe9e11 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2010-06-07  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR libstdc++/44417
index 966d9db057277ae733a5cf5a1a43a099f86c3431..d398c4585a252ff02c52e47ad90c272c0663b1be 100644 (file)
@@ -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)
                {