Skip to content
Snippets Groups Projects
Commit 9b8de3ba authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

remove ifdefs for selecting between plain and hybrid merge sort. use hybrid only.

parent c1b0b1b3
No related branches found
No related tags found
No related merge requests found
...@@ -22,13 +22,6 @@ ...@@ -22,13 +22,6 @@
// for improved performance, we employ an in-place insertion sort on // for improved performance, we employ an in-place insertion sort on
// chunks of up to 64 elements and switch to merge sort from then on. // chunks of up to 64 elements and switch to merge sort from then on.
// compile with -DLMP_USE_MERGE_SORT to switch to a plain merge sort
#if !defined(LMP_USE_MERGE_SORT) && !defined(LMP_USE_HYBRID_SORT)
#define LMP_USE_HYBRID_SORT
#endif
#if defined(LMP_USE_HYBRID_SORT)
// part 1. insertion sort for pre-sorting of small chunks // part 1. insertion sort for pre-sorting of small chunks
static void insertion_sort(int *index, int num, void *ptr, static void insertion_sort(int *index, int num, void *ptr,
...@@ -48,7 +41,6 @@ static void insertion_sort(int *index, int num, void *ptr, ...@@ -48,7 +41,6 @@ static void insertion_sort(int *index, int num, void *ptr,
} }
} }
} }
#endif
// part 2. merge two sublists // part 2. merge two sublists
...@@ -78,8 +70,6 @@ static void merge_sort(int *index, int num, void *ptr, ...@@ -78,8 +70,6 @@ static void merge_sort(int *index, int num, void *ptr,
int chunk,i,j; int chunk,i,j;
#if defined(LMP_USE_HYBRID_SORT)
// do insertion sort on chunks of up to 64 elements // do insertion sort on chunks of up to 64 elements
chunk = 64; chunk = 64;
...@@ -92,10 +82,6 @@ static void merge_sort(int *index, int num, void *ptr, ...@@ -92,10 +82,6 @@ static void merge_sort(int *index, int num, void *ptr,
if (chunk >= num) return; if (chunk >= num) return;
#else
chunk = 1;
#endif
// continue with merge sort on the pre-sorted chunks. // continue with merge sort on the pre-sorted chunks.
// we need an extra buffer for temporary storage and two // we need an extra buffer for temporary storage and two
// pointers to operate on, so we can swap the pointers // pointers to operate on, so we can swap the pointers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment