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.5 by jsr166, Sat Sep 19 18:36:55 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.concurrent.ForkJoinPool;
11   import java.util.function.BinaryOperator;
12 + import java.util.function.DoubleBinaryOperator;
13   import java.util.function.IntBinaryOperator;
14   import java.util.function.LongBinaryOperator;
13 import java.util.function.DoubleBinaryOperator;
15  
16   /**
17   * ForkJoin tasks to perform Arrays.parallelPrefix operations.
# Line 79 | Line 80 | class ArrayPrefixHelpers {
80          T in, out;
81          final int lo, hi, origin, fence, threshold;
82  
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 */
83          CumulateTask(CumulateTask<T> parent, BinaryOperator<T> function,
84                       T[] array, int origin, int fence, int threshold,
85                       int lo, int hi) {
# Line 231 | Line 218 | class ArrayPrefixHelpers {
218          long in, out;
219          final int lo, hi, origin, fence, threshold;
220  
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 */
221          LongCumulateTask(LongCumulateTask parent, LongBinaryOperator function,
222                           long[] array, int origin, int fence, int threshold,
223                           int lo, int hi) {
# Line 381 | Line 354 | class ArrayPrefixHelpers {
354          double in, out;
355          final int lo, hi, origin, fence, threshold;
356  
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 */
357          DoubleCumulateTask(DoubleCumulateTask parent, DoubleBinaryOperator function,
358 <                         double[] array, int origin, int fence, int threshold,
359 <                         int lo, int hi) {
358 >                           double[] array, int origin, int fence, int threshold,
359 >                           int lo, int hi) {
360              super(parent);
361              this.function = function; this.array = array;
362              this.origin = origin; this.fence = fence;
# Line 531 | Line 490 | class ArrayPrefixHelpers {
490          int in, out;
491          final int lo, hi, origin, fence, threshold;
492  
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 */
493          IntCumulateTask(IntCumulateTask parent, IntBinaryOperator function,
494 <                         int[] array, int origin, int fence, int threshold,
495 <                         int lo, int hi) {
494 >                        int[] array, int origin, int fence, int threshold,
495 >                        int lo, int hi) {
496              super(parent);
497              this.function = function; this.array = array;
498              this.origin = origin; this.fence = fence;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines