view src/parallel_execution/twice.c @ 233:06133afb3b5b

create worker start_code
author mir3636
date Sun, 22 Jan 2017 20:02:21 +0900
parents 123b0d277b84
children ce262b2c1daf
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, NULL, 0, 0, NULL,0);
}