view src/parallel_execution/twice.c @ 148:473b7d990a1f

fix data gears type enum
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 10 Nov 2016 12:07:53 +0900
parents a4507906938c
children dec50dd624c7
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, 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);
}