Mercurial > hg > Papers > 2021 > soto-prosym
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Paper/src/twice.c Tue Nov 02 06:55:58 2021 +0900 @@ -0,0 +1,16 @@ +// Twice +__code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int alignment, int* array) { + int i = loopCounter->i; + + if (i < alignment) { + array[i+index*alignment] = array[i+index*alignment]*2; + loopCounter->i++; + + goto meta(context, Twice); + } + + loopCounter->i = 0; + + stack_pop(context->code_stack, &context->next); + goto meta(context, context->next); +}