FLINT3.7.0-dev

flint_merge_sort, flint_sort

Synopsis#include <flint/flint.h>
void flint_merge_sort(void * buf, slong len, slong size, int (* cmp) (const void *, const void *, void *), void * data)source
void flint_sort(void * buf, slong len, slong size, int (* cmp) (const void *, const void *, void *), void * data)source

Sort the array buf of len elements of size bytes each in nondecreasing order. The comparison function receives pointers to two elements and the pointer data, and returns a negative, zero or positive int according to whether the first element is smaller than, equal to or larger than the second.

flint_merge_sort is a stable merge sort using an auxiliary array of len * size bytes. flint_sort calls the C library's qsort_r on systems with the GNU C library and flint_merge_sort elsewhere; it is therefore not guaranteed to be stable.

Cite this page

The FLINT team, “flint_merge_sort, flint_sort (flint.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/flint/flint_merge_sort.html (generated 2026-10-20).