Mercurial > hg > Gears > GearsAgda
view src/parallel_execution/examples/twice/twice.cbc @ 409:4d1e3697a6b8
Add twice cbc file
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 06 Sep 2017 22:01:27 +0900 |
parents | 8ee89eefbc6d |
children | 497b154141de |
line wrap: on
line source
#include <stdio.h> #include "../../../context.h" __code twice(struct Array* array, struct MultiDim* multiDim, __code next(...), struct LoopCounter* loopCounter) { int i = loopCounter->i; int index = multiDim->x; if (i < array->prefix) { array->array[i+index*array->prefix] = array->array[i+index*array->prefix]*2; loopCounter->i++; goto meta(context, C_twice); } loopCounter->i = 0; goto meta(context, context->next); } __code twice_stub(struct Context* context) { goto twice(context, &context->data[context->idg]->Array, &context->data[context->idg+1]->MultiDim, context->next, Gearef(context, LoopCounter)); }