6 |
|
public final class DynamicLeftSpineFib extends RecursiveAction { |
7 |
|
|
8 |
|
static long lastStealCount; |
9 |
< |
|
9 |
> |
|
10 |
|
public static void main(String[] args) throws Exception { |
11 |
|
int procs = 0; |
12 |
|
int num = 45; |
21 |
|
return; |
22 |
|
} |
23 |
|
|
24 |
< |
|
24 |
> |
|
25 |
|
for (int reps = 0; reps < 2; ++reps) { |
26 |
|
ForkJoinPool g = procs == 0? new ForkJoinPool() : |
27 |
|
new ForkJoinPool(procs); |
60 |
|
int number; |
61 |
|
DynamicLeftSpineFib next; |
62 |
|
|
63 |
< |
DynamicLeftSpineFib(int n, DynamicLeftSpineFib nxt) { |
64 |
< |
number = n; next = nxt; |
63 |
> |
DynamicLeftSpineFib(int n, DynamicLeftSpineFib nxt) { |
64 |
> |
number = n; next = nxt; |
65 |
|
} |
66 |
|
|
67 |
|
int getAnswer() { |
68 |
|
return number; |
69 |
|
} |
70 |
< |
public void compute() { |
71 |
< |
number = fib(number); |
70 |
> |
public void compute() { |
71 |
> |
number = fib(number); |
72 |
|
} |
73 |
|
|
74 |
|
static final int fib(int n) { |
97 |
|
r += collectRights(rt); |
98 |
|
return r; |
99 |
|
} |
100 |
< |
|
100 |
> |
|
101 |
|
static final int collectRights(DynamicLeftSpineFib rt) { |
102 |
|
int r = 0; |
103 |
|
while (rt != null) { |