annotate Paper/src/twice.c @ 0:c59202657321

init
author soto <soto@cr.ie.u-ryukyu.ac.jp>
date Tue, 02 Nov 2021 06:55:58 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 // Twice
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 __code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int alignment, int* array) {
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 int i = loopCounter->i;
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 if (i < alignment) {
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 array[i+index*alignment] = array[i+index*alignment]*2;
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 loopCounter->i++;
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 goto meta(context, Twice);
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 }
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 loopCounter->i = 0;
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 stack_pop(context->code_stack, &context->next);
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 goto meta(context, context->next);
soto <soto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }