void bitonicSort(btHashPosKey* pData, int lo, int n, bool dir) { if(n > 1) { int m = n / 2; bitonicSort(pData, lo, m, !dir); bitonicSort(pData, lo + m, n - m, dir); bitonicMerge(pData, lo, n, dir); } }
/** Procedure bitonicSort first produces a bitonic sequence by * recursively sorting its two halves in opposite directions, and then * calls bitonicMerge. **/ void bitonicSort(int lo, int cnt, int dir) { if (cnt>1) { int k=cnt/2; bitonicSort(lo, k, ASCENDING); bitonicSort(lo+k, k, DESCENDING); bitonicMerge(lo, cnt, dir); } }
/** Procedure bitonicSort first produces a bitonic sequence by * recursively sorting its two halves in opposite directions, and then * calls bitonicMerge. **/ void bitonicSort(int lo, int cnt, int dir) { int k = cnt; k /= 2; _Pragma( "marker recMerge" ) if (cnt > 1) { bitonicSort(lo, k, ASCENDING); bitonicSort(lo + k, k, DESCENDING); } bitonicMerge(lo, cnt, dir); _Pragma( "flowrestriction 1*bitonicMerge <= 31*recMerge" ) return; }