comparison src/parallel_execution/examples/bitonicSort/makeArray.cbc @ 404:c5cd9888bf2a

Fix bitonicSort
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Sun, 03 Sep 2017 00:21:16 +0900
parents
children 35b37fe8d3a7
comparison
equal deleted inserted replaced
403:83c9aeb1fe3e 404:c5cd9888bf2a
1 #include "../../../context.h"
2 #include <stdio.h>
3 extern int length;
4 __code makeArray(__code next(struct SortArray* output, struct Time* output1, ...)){
5 struct SortArray* output = *O_output;
6 struct Time* output1 = *O_output1;
7 if (output->loopCounter == 0){
8 output->array = (Integer*)ALLOCATE_ARRAY(context, Integer, length);
9 srand((unsigned) time(NULL));
10 }
11 if (output->loopCounter == GET_SIZE(output->array)){
12 printf("created Array\n");
13 output->loopCounter = 0;
14 Gearef(context, Time)->time = (union Data*)output1;
15 Gearef(context, Time)->next = context->next;
16 *O_output = output;
17 *O_output1 = output1;
18 goto meta(context, output1->start);
19 }
20 output->array[output->loopCounter].value = rand() % 1000;
21 //printf("%d\n", output->array[output->loopCounter]->value);
22 output->loopCounter++;
23 *O_output = output;
24 *O_output1 = output1;
25 goto meta(context, C_makeArray);
26 }
27
28 __code makeArray_stub(struct Context* context) {
29 SortArray** O_output = (struct SortArray**)&context->data[context->odg];
30 Time** O_output1 = (struct Time**)&context->data[context->odg+1];
31 goto makeArray(context,
32 context->next,
33 O_output,
34 O_output1);
35 }