CMR
1.3.0
|
Macros | |
#define | MOVE_ELEMENT(source, target, size) |
Functions | |
CMR_ERROR | CMRsort (CMR *cmr, size_t length, void *array, size_t elementSize, int(*compare)(const void *, const void *)) |
Sorts an array. More... | |
CMR_ERROR | CMRsort2 (CMR *cmr, size_t length, void *array1, size_t elementSize1, void *array2, size_t elementSize2, int(*compare)(const void **, const void **)) |
Sorts two arrays simultaneously. More... | |
#define MOVE_ELEMENT | ( | source, | |
target, | |||
size | |||
) |
CMR_ERROR CMRsort | ( | CMR * | cmr, |
size_t | length, | ||
void * | array, | ||
size_t | elementSize, | ||
int(*)(const void *, const void *) | compare | ||
) |
Sorts an array.
The user must provide a compare
function that is called several times with pointers into the first array. The arguments must be dereferenced once in order to access the actual element.
cmr | CMR environment. |
length | Number of elements in both arrays. |
array | Pointer to the first element of the array. |
elementSize | Size (in bytes) of each element of the array. |
compare | Comparison function for comparing two elements. |
CMR_ERROR CMRsort2 | ( | CMR * | cmr, |
size_t | length, | ||
void * | array1, | ||
size_t | elementSize1, | ||
void * | array2, | ||
size_t | elementSize2, | ||
int(*)(const void **, const void **) | compare | ||
) |
Sorts two arrays simultaneously.
Sorts two arrays using the qsort function from the C library. The user must provide a compare
function that is called several times with pointers to pointers into the first array. Hence, the arguments must be dereferenced twice in order to access the actual element.
cmr | CMR environment. |
length | Number of elements in both arrays. |
array1 | Pointer to the first element of the first array. |
elementSize1 | Size (in bytes) of each element of the first array. |
array2 | Pointer to the first element of the second array. |
elementSize2 | Size (in bytes) of each element of the second array. |
compare | Comparison function for comparing two elements. |