#include "../../context.h" #include __code bitonicSwap(struct SortArray* inputArray, struct Integer* block, struct Integer* first, struct Integer* i, __code next(struct SortArray* output, ...)) { struct SortArray* output = *O_output; int position = i->value/block->value; int index = i->value+block->value*position; block->value = (first->value == 1)? ((block->value<<1)*(position+1))-(index%block->value)-1 : index+block->value; struct Integer** array = inputArray->array; printf("block:%d\n", block->value); printf("index:%d\n", index); if (array[block->value] < array[index]) { struct Integer *tmp = array[index]; array[index] = array[block->value]; array[block->value] = tmp; } output->array = array; *O_output = output; goto meta(context, next); } __code bitonicSwap_stub(struct Context* context) { SortArray** O_output = (struct SortArray **)&context->data[context->odg]; goto bitonicSwap(context, &context->data[context->idg]->SortArray, &context->data[context->idg+1]->Integer, &context->data[context->idg+2]->Integer, &context->data[context->idg+3]->Integer, context->next, O_output); }