58 const UINT p = 1<<(i - 1);
60 for(UINT j=p; j>0; j/=2){
62 const UINT nUpperMin = min(j + k,
m_nInputs - j);
64 for(UINT nMin=k; nMin<nUpperMin; nMin++){
65 const UINT nMax = nMin + j;
67 if((nMin >> i) == (nMax >> i))
82 return std::wstring(L
"OddEven" + std::to_wstring(
m_nInputs));
Header for useful helper functions.
Interface for Batcher's odd-even sorting network.
void InsertComparator(UINT, UINT, UINT)
Insert comparator.
UINT m_nInputs
Number of inputs.
void CreateMatchArray(UINT, UINT)
Create match array.
UINT m_nLog2n
Log base 2 of the number of inputs.
void CreateComparators()
Create comparators.
const std::wstring GetName() const
Get name.
COddEvenSort(const UINT)
Constructor.
void CreateUsageArray()
Make usage array.
void CreateValueArray()
Make value array.