view src/parallel_execution/examples/bitonicSort/makeArray.cbc @ 530:1566caacdaae

Fix bitonicSort
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Sat, 27 Jan 2018 23:05:27 +0900
parents 82ff74c2f162
children 4fdeb0afc187
line wrap: on
line source

#include "../../../context.h"
#include <stdio.h>
#interface "Timer.h"

extern int length;
__code makeArray(__code next(struct SortArray* output, struct Timer* output1, ...)){
    if (output->loopCounter == 0){
        output->array = (Integer*)ALLOCATE_ARRAY(context, Integer, length);
        srand((unsigned) time(NULL));
    }
    if (output->loopCounter == GET_LEN(output->array)){
        printf("created Array\n");
        output->loopCounter = 0;
        goto output1->start(next(output1, ...));
    }
    output->array[output->loopCounter].value = rand() % 1000;
    //printf("%d\n", output->array[output->loopCounter]->value);
    output->loopCounter++;
    goto makeArray();
}