Mercurial > hg > Game > Cerium
view example/bitonic_sort/ppe/swap.cc @ 2054:2e7a6f40672f draft
add param(4) in FileMapReduce.cc
author | masa |
---|---|
date | Fri, 29 Jan 2016 15:56:28 +0900 |
parents | bc010492ade4 |
children |
line wrap: on
line source
#include "swap.h" SchedDefineTask1(swap,swap); static int swap(SchedTask* s, void* rbuf,void* wbuf) { int* inData = (int*)s->get_input(rbuf, 0); int* outData = (int*)s->get_output(wbuf, 0); long block = (long)s->get_param(0); long first = (long)s->get_param(1); int x = s->x; int position = x/block; int index = x+block*position; block = (first == 1)? ((block<<1)*(position+1))-(index%block)-1 : index+block; if (inData[block] < inData[index]) { int tmp = inData[index]; outData[index] = inData[block]; outData[block] = tmp; } return 0; }