|
CGUL_EXPORT void | cgul_radix_sort (cgul_exception_t *cex, void *v, size_t v_count, size_t element_size, int ascending_order, cgul_radix_sort__enumerate_t ef, int are_enumerations_signed) |
|
CGUL_EXPORT void | cgul_radix_sort_pointers (cgul_exception_t *cex, void **v, size_t v_count, int ascending_order, cgul_radix_sort__enumerate_t ef, int are_enumerations_signed) |
|
CGUL_EXPORT void | cgul_radix_sort_schar (cgul_exception_t *cex, signed char *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_uchar (cgul_exception_t *cex, unsigned char *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_short (cgul_exception_t *cex, short int *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_ushort (cgul_exception_t *cex, unsigned short int *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_int (cgul_exception_t *cex, int *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_uint (cgul_exception_t *cex, unsigned int *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_long (cgul_exception_t *cex, long int *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_ulong (cgul_exception_t *cex, unsigned long int *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_int8 (cgul_exception_t *cex, cgul_int8_t *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_uint8 (cgul_exception_t *cex, cgul_uint8_t *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_int16 (cgul_exception_t *cex, cgul_int16_t *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_uint16 (cgul_exception_t *cex, cgul_uint16_t *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_int32 (cgul_exception_t *cex, cgul_int32_t *v, size_t v_count, int ascending_order) |
|
CGUL_EXPORT void | cgul_radix_sort_uint32 (cgul_exception_t *cex, cgul_uint32_t *v, size_t v_count, int ascending_order) |
|
Perform an in-place radix sort on the array v
which holds v_count
instances of signed char
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. This function assumes the computer represents negative values using two's complement (which should be true for the vast majority of computers). If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of unsigned char
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of short
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. This function assumes the computer represents negative values using two's complement (which should be true for the vast majority of computers). If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of unsigned short
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of int
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. This function assumes the computer represents negative values using two's complement (which should be true for the vast majority of computers). If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of unsigned int
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of long
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. This function assumes the computer represents negative values using two's complement (which should be true for the vast majority of computers). If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of unsigned long
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of cgul_int8_t
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. This function assumes the computer represents negative values using two's complement (which should be true for the vast majority of computers). If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of cgul_int16_t
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. This function assumes the computer represents negative values using two's complement (which should be true for the vast majority of computers). If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of cgul_int32_t
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. This function assumes the computer represents negative values using two's complement (which should be true for the vast majority of computers). If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
Perform an in-place radix sort on the array v
which holds v_count
instances of cgul_uint32_t
values. On return, v
will be in ascending order if ascending_order
is true or in descending order otherwise. This functions internally allocates (and releases) an extra array large enough to hold a copy of v
. If an error occurs, an exception is thrown.
If another sort order is desired, use cgul_radix_sort()
or cgul_radix_sort_pointers()
, but they are much slower than this function.
- Parameters
-
[in,out] | cex | c-style exception |
[in] | v | array of elements to sort |
[in] | v_count | number of elements in v |
[in] | ascending_order | whether to sort in ascending order |
CGUL_BEGIN_C typedef unsigned long int(* cgul_radix_sort__enumerate_t) (const void *element) |
This typedef is the interface the client must define in order for cgul_radix_sort()
or cgul_radix_sort_pointers()
to sort an array. This function will be called repeatedly during the sorting process, and it should consistently return the same unsigned long
value that is associated with the element element
from the array being sorted. The elements from the array will then be sorted in ascending order of the enumerations.
If a signed enumeration is more natural for the array being sorted, just have your enumeration function cast the signed enumeration to an unsigned long
and use the are_enumerations_signed
parameter that is provided for all functions that accept an enumeration function. Alternatively, your enumeration function could just shift the signed values into the unsigned range and return only unsigned values. If the shifted sort order is the same as the original sort order, the end result will be the same.
- Parameters
-
[in] | element | element from the array being sorted |
- Returns
- enumeration for
element