Dylan Smith <dylan.ah.smith(a)gmail.com> writes:
+static void sort_vertex_indices(struct point2d_index *start, int count) +{ + struct point2d_index *current, *middle_value, *last; + int below_count; + + if (count <= 1) + return; + + /* quick sort */ + last = start + count - 1; + middle_value = last--; + current = start; + while (current <= last) + { + if (compare_vertex_indices(current, middle_value) < 0) { + current++; + } else { + swap_vertex_indices(current, last); + last--; + } + } + swap_vertex_indices(current, middle_value); + + below_count = current - start; + sort_vertex_indices(start, below_count); + sort_vertex_indices(current + 1, count - below_count - 1); +}
Is there a reason for not using qsort? -- Alexandre Julliard julliard(a)winehq.org