STATIC void sort_mem_regions(void)
{
   insertion_sort_generic(mem_regions,
                          sizeof(memory_region_t),
                          (u32)mem_regions_count,
                          less_than_cmp_mem_region);
}
Exemple #2
0
void qsort_generic(void **arr, int len, cmp_fun cmp){
  if(len < QSORT_MIN_LENGTH){
    //putting a check for non-zero len here might speed things up
    insertion_sort_generic(arr, len, cmp);
  } else {
    int pivot_idx = qsort_partition(arr, 0, len-1, cmp);
    qsort_generic(arr, pivot_idx+1, cmp);
    qsort_generic(arr+(pivot_idx+1), len - (pivot_idx+1), cmp);
  }
  return;
}
Exemple #3
0
uint64_t* insertion_sort_u64(uint64_t *input, size_t len){
  insertion_sort_generic((void**)input, len, cmp_lt);
  return input;
}