forked from lijiext/lammps
apply fix for merge sort from issue #1163 by @jtfrey and re-enable it
This commit is contained in:
parent
527ec61586
commit
da38ae0370
|
@ -46,13 +46,6 @@
|
|||
#define PRId64 "ld"
|
||||
#endif
|
||||
|
||||
// favor qsort over mergesort for stable release
|
||||
// TODO: to be removed after stable release
|
||||
|
||||
#ifndef LMP_QSORT
|
||||
#define LMP_QSORT
|
||||
#endif
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
// enum used for KOKKOS host/device flags
|
||||
|
|
|
@ -98,7 +98,7 @@ static void merge_sort(int *index, int num, void *ptr,
|
|||
|
||||
int *tmp = dest; dest = hold; hold = tmp;
|
||||
|
||||
// merge from hold array to destiation array
|
||||
// merge from hold array to destination array
|
||||
|
||||
for (i=0; i < num-1; i += 2*chunk) {
|
||||
j = i + 2*chunk;
|
||||
|
@ -107,6 +107,10 @@ static void merge_sort(int *index, int num, void *ptr,
|
|||
if (m > num) m=num;
|
||||
do_merge(dest,hold,i,m,m,j,ptr,comp);
|
||||
}
|
||||
|
||||
// copy all indices not handled by the chunked merge sort loop
|
||||
|
||||
for ( ; i < num ; i++ ) dest[i] = hold[i];
|
||||
chunk *= 2;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue