view src/parallel_execution/twice.c @ 223:8d2519c3a36e

Add input data gear example
author one
date Wed, 11 Jan 2017 17:19:53 +0900
parents c34e6aa10967
children 123b0d277b84
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, enum Code next) {
    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, next);
}

__code twice_stub(struct Context* context) {
    goto twice(context,
               &context->data[task->data[0]]->LoopCounter,
               context->data[task->data[1]]->Node.value->Array.index,
               context->data[task->data[2]]->Node.value->Array.prefix,
               context->data[task->data[3]]->Node.value->Array.array
               task->next);
}