view src/parallel_execution/twice.cbc @ 277:9d671e63df74

generate extern
author mir3636
date Thu, 02 Feb 2017 18:29:50 +0900
parents src/parallel_execution/twice.c@cd3486e4ba70
children 23767f714f4a
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, struct Context* workerContext) {
    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(workerContext, workerContext->next);
}

__code twice_stub(struct Context* context) {
    struct Context* workerContext = context->worker->worker->CPUWorker.context;
    goto twice(context, Gearef(context, LoopCounter), 0, 0, NULL, workerContext);
}