view src/parallel_execution/twice.c @ 217:c34e6aa10967

Fix DataGear access name
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Mon, 09 Jan 2017 01:18:13 +0900
parents 119c035e0e36
children 8d2519c3a36e
line wrap: on
line source

#include <stdio.h>

#include "context.h"
#include "origin_cs.h"

__code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array) {
    int i = loopCounter->i;

    if (i < prefix) {
        array[i+index*prefix] = array[i+index*prefix]*2;
        loopCounter->i++;

        goto meta(context, C_twice);
    }

    loopCounter->i = 0;

    //stack_pop(context->code_stack, &context->next);
    goto meta(context, context->next);
}

__code twice_stub(struct Context* context) {
    goto twice(context,
               &context->data[D_LoopCounter]->LoopCounter,
               context->data[D_Node]->Node.value->Array.index,
               context->data[D_Node]->Node.value->Array.prefix,
               context->data[D_Node]->Node.value->Array.array);
}