ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/ArraysSort.java
(Generate patch)

Comparing jsr166/src/test/loops/ArraysSort.java (file contents):
Revision 1.1 by dl, Thu Jul 30 20:24:10 2015 UTC vs.
Revision 1.4 by jsr166, Sat Sep 12 19:09:00 2015 UTC

# Line 15 | Line 15 | class ArraysSort {
15      static final Comparator<Object> cmp = (Object x, Object y) ->
16          ((Long)x).compareTo((Long)y);
17  
18
18      public static void main(String[] args) throws Exception {
19          int n = 1 << 22;
20          int reps = 30;
# Line 36 | Line 35 | class ArraysSort {
35              numbers[i] = Long.valueOf(i);
36  
37          int thr = ((n + 7) >>> 3) / ForkJoinPool.getCommonPoolParallelism();
38 <        THRESHOLD = (thr <= 1 << 13)? 1 << 13 : thr;
38 >        THRESHOLD = (thr <= 1 << 13) ? 1 << 13 : thr;
39  
40          System.out.println("Threshold = " + THRESHOLD);
41  
# Line 122 | Line 121 | class ArraysSort {
121  
122      static void checkSorted(Long[] a) {
123          int n = a.length;
124 <        long x = ((Long)a[0]).longValue(), y;
124 >        long x = a[0].longValue(), y;
125          for (int i = 0; i < n - 1; i++) {
126 <            if (x > (y = ((Long)a[i+1]).longValue()))
126 >            if (x > (y = a[i+1].longValue()))
127                  throw new Error("Unsorted at " + i + ": " + x + " / " + y);
128              x = y;
129          }
# Line 153 | Line 152 | class ArraysSort {
152              }
153              ThreadLocalRandom rng = ThreadLocalRandom.current();
154              Long dl = d[l];
155 <            int m = (dl == null)? h : rng.nextInt(l, h);
155 >            int m = (dl == null) ? h : rng.nextInt(l, h);
156              for (int i = l; i < m; ++i)
157                  d[i] = s[rng.nextInt(n)];
158              if (dl != null) {
# Line 185 | Line 184 | class ArraysSort {
184              }
185              int bound = h < n ? h : n - 1;
186              int i = l;
187 <            long x = ((Long)a[i]).longValue(), y;
187 >            long x = a[i].longValue(), y;
188              while (i < bound) {
189 <                if (x > (y = ((Long)a[++i]).longValue()))
189 >                if (x > (y = a[++i].longValue()))
190                      throw new Error("Unsorted " + x + " / " + y);
191                  x = y;
192              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines