Mercurial > hg > Members > Moririn
annotate src/parallel_execution/twice.c @ 233:06133afb3b5b
create worker start_code
author | mir3636 |
---|---|
date | Sun, 22 Jan 2017 20:02:21 +0900 |
parents | 123b0d277b84 |
children | ce262b2c1daf |
rev | line source |
---|---|
92 | 1 #include <stdio.h> |
2 | |
3 #include "context.h" | |
4 #include "origin_cs.h" | |
5 | |
223 | 6 __code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array, enum Code next) { |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
7 int i = loopCounter->i; |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
8 |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
9 if (i < prefix) { |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
10 array[i+index*prefix] = array[i+index*prefix]*2; |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
11 loopCounter->i++; |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
12 |
193 | 13 goto meta(context, C_twice); |
95
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
14 } |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
15 |
3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
92
diff
changeset
|
16 loopCounter->i = 0; |
92 | 17 |
131
a4507906938c
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
109
diff
changeset
|
18 //stack_pop(context->code_stack, &context->next); |
223 | 19 goto meta(context, next); |
92 | 20 } |
21 | |
22 __code twice_stub(struct Context* context) { | |
232 | 23 goto twice(context, NULL, 0, 0, NULL,0); |
92 | 24 } |