1#ifndef GIM_RADIXSORT_H_INCLUDED
2#define GIM_RADIXSORT_H_INCLUDED
44 template <
class T,
class Z>
47 return (a < b ? -1 : (a > b ? 1 : 0));
132#define D11_0(x) (x & 0x7FF)
133#define D11_1(x) (x >> 11 & 0x7FF)
134#define D11_2(x) (x >> 22)
145 for (i = 0; i <
kHist * 3; ++i)
161 for (i = 0; i <
kHist; ++i)
207template <
typename T,
class GETKEY_CLASS>
232template <
typename T,
class GETKEY_CLASS,
class COPY_CLASS>
260template <
class T,
typename KEYCLASS,
typename COMP_CLASS>
334template <
typename T,
typename COMP_CLASS>
365template <
typename T,
typename COMP_CLASS>
371 for (
k = n / 2;
k > 0;
k--)
const T & btMax(const T &a, const T &b)
Prototype for comparators.
int operator()(const GIM_RSORT_TOKEN &a, const GIM_RSORT_TOKEN &b)
Prototype for copying elements.
void operator()(T &a, T &b)
Prototype for comparators.
int operator()(const T &a, const T &b)
int operator()(const T &a, const Z &b)
Prototype for copying elements.
void operator()(T &a, T &b)
Prototype for getting the integer representation of an object.
GUINT operator()(const T &a)
void * gim_alloc(size_t size)
Standar Memory functions.
void gim_simd_memcpy(void *dst, const void *src, size_t copysize)
void gim_swap_elements(T *_array, size_t _i, size_t _j)
bool gim_binary_search(const T *_array, GUINT _start_i, GUINT _end_i, const T &_search_key, GUINT &_result_index)
Failsafe Iterative binary search,Template version.
void gim_heap_sort(T *pArr, GUINT element_count, COMP_CLASS CompareFunc)
void gim_radix_sort_array_tokens(T *array, GIM_RSORT_TOKEN *sorted_tokens, GUINT element_count, GETKEY_CLASS uintkey_macro)
Get the sorted tokens from an array. For generic use. Tokens are IRR_RSORT_TOKEN.
bool gim_binary_search_ex(const T *_array, GUINT _start_i, GUINT _end_i, GUINT &_result_index, const KEYCLASS &_search_key, COMP_CLASS _comp_macro)
Failsafe Iterative binary search,.
void gim_down_heap(T *pArr, GUINT k, GUINT n, COMP_CLASS CompareFunc)
heap sort from http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Sort/Heap/
void gim_radix_sort_rtokens(GIM_RSORT_TOKEN *array, GIM_RSORT_TOKEN *sorted, GUINT element_count)
Radix sort for unsigned integer keys.
void gim_radix_sort(T *array, GUINT element_count, GETKEY_CLASS get_uintkey_macro, COPY_CLASS copy_elements_macro)
Sorts array in place. For generic use.
bool operator<(const GIM_RSORT_TOKEN &other) const
GIM_RSORT_TOKEN(const GIM_RSORT_TOKEN &rtoken)
bool operator>(const GIM_RSORT_TOKEN &other) const