diff --git a/src/hhalignment.cpp b/src/hhalignment.cpp index 88f5a05f..d95d967e 100755 --- a/src/hhalignment.cpp +++ b/src/hhalignment.cpp @@ -1673,11 +1673,20 @@ int Alignment::Filter2(char keep[], int coverage, int qid, float qsc, } // Sort sequences according to length; afterwards, nres[ksort[kk]] is sorted by size + + struct sortDesc + { + int* _nres; + sortDesc(int* nres) : _nres(nres){} + bool operator()(int left, int right) { + return _nres[left] > _nres[right]; + } + }; if (ksort == NULL) { ksort = new int[N_in]; // never reuse alignment object for new alignment with more sequences for (k = 0; k < N_in; ++k) ksort[k] = k; - QSortInt(nres, ksort, kfirst + 1, N_in - 1, -1); //Sort sequences after kfirst (query) in descending order + std::stable_sort(ksort + kfirst + 1 , ksort+ N_in, sortDesc(nres)); //Sort sequences after kfirst (query) in descending order } for (kk = 0; kk < N_in; ++kk) { inkk[kk] = in[ksort[kk]];