# HG changeset patch # User Nozomi Teruya # Date 1498740310 -32400 # Node ID 5d45b2943265d07c48a2872a25a7c7289f386dd1 # Parent 136ce3537438c008252410303b025f3f09457166 bitonic_sort is working!:D diff -r 136ce3537438 -r 5d45b2943265 src/parallel_execution/examples/sort.cbc --- a/src/parallel_execution/examples/sort.cbc Thu Jun 29 19:21:18 2017 +0900 +++ b/src/parallel_execution/examples/sort.cbc Thu Jun 29 21:45:10 2017 +0900 @@ -27,7 +27,7 @@ goto meta(context, C_print); } struct Integer* integer = new Integer(); - integer->value = rand() % 20; + integer->value = rand() % 1000; sortArray->sortArray->array[sortArray->sortArray->loop_counter] = integer; sortArray->sortArray->loop_counter++; goto meta(context, C_make_array); @@ -71,7 +71,7 @@ __code kernel2(struct SortArray* sortArray){//ソートの中身 int i = sortArray->sortArray->loop_counter3; int up = ((i >> sortArray->sortArray->loop_counter) & 2) == 0; - int d = (sortArray->sortArray->loop_counter - sortArray->sortArray->loop_counter2); + int d = 1 << (sortArray->sortArray->loop_counter - sortArray->sortArray->loop_counter2); sortArray->sortArray->d = d; if (i >= GET_SIZE(sortArray->sortArray->array)){//ループの終了→上のループへ @@ -80,7 +80,7 @@ goto meta(context, C_kernel); } - if ((i & d) == 0 && (sortArray->sortArray->array[i] > sortArray->sortArray->array[i | d]) == up) { + if ((i & d) == 0 && (sortArray->sortArray->array[i]->value > sortArray->sortArray->array[i | d]->value) == up) { goto meta(context, C_swap); }