23 #include "mysys_priv.h"
28 my_bool radixsort_is_appliccable(uint n_items,
size_t size_of_element)
30 return size_of_element <= 20 && n_items >= 1000 && n_items < 100000;
33 void radixsort_for_str_ptr(uchar **base, uint number_of_elements,
size_t size_of_element, uchar **buffer)
35 uchar **end,**ptr,**buffer_ptr;
36 uint32 *count_ptr,*count_end,count[256];
39 end=base+number_of_elements; count_end=count+256;
40 for (pass=(
int) size_of_element-1 ; pass >= 0 ; pass--)
42 memset(count, 0,
sizeof(uint32)*256);
43 for (ptr= base ; ptr < end ; ptr++)
44 count[ptr[0][pass]]++;
45 if (count[0] == number_of_elements)
47 for (count_ptr=count+1 ; count_ptr < count_end ; count_ptr++)
49 if (*count_ptr == number_of_elements)
51 (*count_ptr)+= *(count_ptr-1);
53 for (ptr= end ; ptr-- != base ;)
54 buffer[--count[ptr[0][pass]]]= *ptr;
55 for (ptr=base, buffer_ptr=buffer ; ptr < end ;)
56 (*ptr++) = *buffer_ptr++;