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; |
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 |
|
|
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 |
|
} |
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) { |
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 |
|
} |