--- jsr166/src/test/loops/BoxedLongSort.java 2012/04/09 13:18:06 1.7 +++ jsr166/src/test/loops/BoxedLongSort.java 2015/01/15 18:34:18 1.11 @@ -4,8 +4,8 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -import java.util.concurrent.*; import java.util.*; +import java.util.concurrent.*; class BoxedLongSort { static final long NPS = (1000L * 1000 * 1000); @@ -68,7 +68,7 @@ class BoxedLongSort { long now = System.nanoTime(); double total = (double)(now - start) / NPS; double elapsed = (double)(now - last) / NPS; - System.out.printf("Arrays.sort time: %7.3f total %9.3f\n", + System.out.printf("Arrays.sort time: %7.3f total %9.3f\n", elapsed, total); if (i == 0) checkSorted(a); @@ -90,7 +90,7 @@ class BoxedLongSort { // pool.invoke(new TaskChecker()); double total = (double)(now - start) / NPS; double elapsed = (double)(now - last) / NPS; - System.out.printf("Parallel sort time: %7.3f total %9.3f\n", + System.out.printf("Parallel sort time: %7.3f total %9.3f\n", elapsed, total); if (i == 0) checkSorted(a); @@ -165,7 +165,6 @@ class BoxedLongSort { * and finding index of right closest to split point. * Uses left-spine decomposition to generate all * merge tasks before bottomming out at base case. - * */ public final void compute() { Merger rights = null; @@ -202,15 +201,15 @@ class BoxedLongSort { Long al = a[l], ar; if (r >= rFence || al.longValue() <= (ar = a[r]).longValue()) { - ++l; t = al; - } - else { - ++r; t = ar; + ++l; t = al; + } + else { + ++r; t = ar; } } else if (r < rFence) t = a[r++]; - else + else break; w[k++] = t; } @@ -290,17 +289,16 @@ class BoxedLongSort { } } - static final class RandomRepacker extends RecursiveAction { final Long[] src; final Long[] dst; final int lo, hi, size; - RandomRepacker(Long[] src, Long[] dst, + RandomRepacker(Long[] src, Long[] dst, int lo, int hi, int size) { this.src = src; this.dst = dst; this.lo = lo; this.hi = hi; this.size = size; } - + public final void compute() { Long[] s = src; Long[] d = dst;