annotate paper/src/twice.c @ 35:7c5d27175aa4 default tip

fix
author ikkun
date Tue, 16 May 2017 16:19:47 +0900
parents 38b037c42c34
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
38b037c42c34 first commit
ikkun
parents:
diff changeset
1 // Twice
38b037c42c34 first commit
ikkun
parents:
diff changeset
2 __code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int alignment, int* array) {
38b037c42c34 first commit
ikkun
parents:
diff changeset
3 int i = loopCounter->i;
38b037c42c34 first commit
ikkun
parents:
diff changeset
4
38b037c42c34 first commit
ikkun
parents:
diff changeset
5 if (i < alignment) {
38b037c42c34 first commit
ikkun
parents:
diff changeset
6 array[i+index*alignment] = array[i+index*alignment]*2;
38b037c42c34 first commit
ikkun
parents:
diff changeset
7 loopCounter->i++;
38b037c42c34 first commit
ikkun
parents:
diff changeset
8
38b037c42c34 first commit
ikkun
parents:
diff changeset
9 goto meta(context, Twice);
38b037c42c34 first commit
ikkun
parents:
diff changeset
10 }
38b037c42c34 first commit
ikkun
parents:
diff changeset
11
38b037c42c34 first commit
ikkun
parents:
diff changeset
12 loopCounter->i = 0;
38b037c42c34 first commit
ikkun
parents:
diff changeset
13
38b037c42c34 first commit
ikkun
parents:
diff changeset
14 stack_pop(context->code_stack, &context->next);
38b037c42c34 first commit
ikkun
parents:
diff changeset
15 goto meta(context, context->next);
38b037c42c34 first commit
ikkun
parents:
diff changeset
16 }