33 typedef unsigned long long int Uint64;
38 #define GnomeSort(T) \ 39 static void GnomeSort_##T(T a[], const int n, const int inc) \ 44 if (i == 0 || a[i-1] <= a[i]) ++i; \ 45 else {T tmp = a[i]; a[i] = a[i-1]; a[--i] = tmp;} \ 49 if (i == 0 || a[(i-1)*inc] <= a[i*inc]) ++i; \ 50 else {T tmp = a[i*inc]; a[i*inc] = a[(i-1)*inc]; a[(--i)*inc] = tmp;} \ 54 static void GnomeSortIdx_##T(const T a[], const int n, const int inc, int index[], const int index_adj) \ 60 if (i == 0 || a[index[i-1]-index_adj] <= a[index[i]-index_adj]) ++i; \ 61 else {int tmp = index[i]; index[i] = index[i-1]; index[--i] = tmp;} \ 65 if (i == 0 || a[index[i-1]] <= a[index[i]]) i++; \ 66 else {int tmp = index[i]; index[i] = index[i-1]; index[--i] = tmp;} \ 72 if (i == 0 || a[(index[i-1]-index_adj)*inc] <= a[(index[i]-index_adj)*inc]) ++i; \ 73 else {int tmp = index[i]; index[i] = index[i-1]; index[--i] = tmp;} \ 77 if (i == 0 || a[index[i-1]*inc] <= a[index[i]*inc]) ++i; \ 78 else {int tmp = index[i]; index[i] = index[i-1]; index[--i] = tmp;} \ 86 if (index && nidx >= n) { \ 87 GnomeSortIdx_##T(&data[addr], n, inc, index, index_adj); \ 89 GnomeSort_##T(&data[addr], n, inc); \ 112 ecgnomesort_(
const int *Mode,
115 const int *Start_addr,
119 const int *Index_adj,
128 int index_adj = *Index_adj;
129 int addr = (*Start_addr) - 1;
131 if (method != SORT_UINT &&
132 method != SORT_INT &&
133 method != SORT_R64 &&
134 method != SORT_R32 &&
135 method != SORT_I64 &&
136 method != SORT_U64 ) {
unsigned long long int Uint64
unsigned long long int Uint64
integer(kind=kindofint) nidx