Mercurial > hg > Members > Moririn
changeset 367:5d45b2943265
bitonic_sort is working!:D
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 29 Jun 2017 21:45:10 +0900 |
parents | 136ce3537438 |
children | 5506a5d61a05 |
files | src/parallel_execution/examples/sort.cbc |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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); }