view src/parallel_execution/twice.cbc @ 309:8c2123bb577b

fix compile errors
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 14 Feb 2017 21:55:11 +0900
parents f1b0cc555b6e
children
line wrap: on
line source

#include <stdio.h>

#include "../context.h"

__code twice(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;
    goto meta(context, context->next);
}

__code twice_stub(struct Context* context) {
    struct LoopCounter* loopCounter = &context->data[context->dataNum]->LoopCounter;
    struct Array* array = &context->data[context->dataNum+1]->Array;
    goto twice(context,
               loopCounter,
               array->index,
               array->prefix,
               array->array);
}