ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/ArrayPrefixHelpers.java
(Generate patch)

Comparing jsr166/src/main/java/util/ArrayPrefixHelpers.java (file contents):
Revision 1.3 by jsr166, Wed Dec 31 04:53:37 2014 UTC vs.
Revision 1.8 by jsr166, Sun Sep 20 17:29:14 2015 UTC

# Line 5 | Line 5
5   */
6  
7   package java.util;
8 < import java.util.concurrent.ForkJoinPool;
8 >
9   import java.util.concurrent.CountedCompleter;
10   import java.util.function.BinaryOperator;
11 + import java.util.function.DoubleBinaryOperator;
12   import java.util.function.IntBinaryOperator;
13   import java.util.function.LongBinaryOperator;
13 import java.util.function.DoubleBinaryOperator;
14  
15   /**
16   * ForkJoin tasks to perform Arrays.parallelPrefix operations.
# Line 79 | Line 79 | class ArrayPrefixHelpers {
79          T in, out;
80          final int lo, hi, origin, fence, threshold;
81  
82        /** Root task constructor */
83        public CumulateTask(CumulateTask<T> parent,
84                            BinaryOperator<T> function,
85                            T[] array, int lo, int hi) {
86            super(parent);
87            this.function = function; this.array = array;
88            this.lo = this.origin = lo; this.hi = this.fence = hi;
89            int p;
90            this.threshold =
91                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
92                <= MIN_PARTITION ? MIN_PARTITION : p;
93        }
94
95        /** Subtask constructor */
82          CumulateTask(CumulateTask<T> parent, BinaryOperator<T> function,
83                       T[] array, int origin, int fence, int threshold,
84                       int lo, int hi) {
# Line 231 | Line 217 | class ArrayPrefixHelpers {
217          long in, out;
218          final int lo, hi, origin, fence, threshold;
219  
234        /** Root task constructor */
235        public LongCumulateTask(LongCumulateTask parent,
236                                LongBinaryOperator function,
237                                long[] array, int lo, int hi) {
238            super(parent);
239            this.function = function; this.array = array;
240            this.lo = this.origin = lo; this.hi = this.fence = hi;
241            int p;
242            this.threshold =
243                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
244                <= MIN_PARTITION ? MIN_PARTITION : p;
245        }
246
247        /** Subtask constructor */
220          LongCumulateTask(LongCumulateTask parent, LongBinaryOperator function,
221                           long[] array, int origin, int fence, int threshold,
222                           int lo, int hi) {
# Line 381 | Line 353 | class ArrayPrefixHelpers {
353          double in, out;
354          final int lo, hi, origin, fence, threshold;
355  
384        /** Root task constructor */
385        public DoubleCumulateTask(DoubleCumulateTask parent,
386                                DoubleBinaryOperator function,
387                                double[] array, int lo, int hi) {
388            super(parent);
389            this.function = function; this.array = array;
390            this.lo = this.origin = lo; this.hi = this.fence = hi;
391            int p;
392            this.threshold =
393                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
394                <= MIN_PARTITION ? MIN_PARTITION : p;
395        }
396
397        /** Subtask constructor */
356          DoubleCumulateTask(DoubleCumulateTask parent, DoubleBinaryOperator function,
357 <                         double[] array, int origin, int fence, int threshold,
358 <                         int lo, int hi) {
357 >                           double[] array, int origin, int fence, int threshold,
358 >                           int lo, int hi) {
359              super(parent);
360              this.function = function; this.array = array;
361              this.origin = origin; this.fence = fence;
# Line 531 | Line 489 | class ArrayPrefixHelpers {
489          int in, out;
490          final int lo, hi, origin, fence, threshold;
491  
534        /** Root task constructor */
535        public IntCumulateTask(IntCumulateTask parent,
536                                IntBinaryOperator function,
537                                int[] array, int lo, int hi) {
538            super(parent);
539            this.function = function; this.array = array;
540            this.lo = this.origin = lo; this.hi = this.fence = hi;
541            int p;
542            this.threshold =
543                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
544                <= MIN_PARTITION ? MIN_PARTITION : p;
545        }
546
547        /** Subtask constructor */
492          IntCumulateTask(IntCumulateTask parent, IntBinaryOperator function,
493 <                         int[] array, int origin, int fence, int threshold,
494 <                         int lo, int hi) {
493 >                        int[] array, int origin, int fence, int threshold,
494 >                        int lo, int hi) {
495              super(parent);
496              this.function = function; this.array = array;
497              this.origin = origin; this.fence = fence;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines