Fix heapsort, add test
This commit is contained in:
@@ -8,11 +8,20 @@ extern "C" {
|
||||
#endif
|
||||
///compare function. Needs only to return < 0 if
|
||||
//the first element is less than the second
|
||||
typedef int (*uc_hs_cmp)(const void *, const void *);
|
||||
typedef int (*uc_hs_cmp)(const void *, const void *, void *cookie);
|
||||
//swap function
|
||||
typedef void (*uc_hs_swp)(void *, void *);
|
||||
|
||||
void
|
||||
uc_heapsort(void *base, size_t count, size_t width,
|
||||
uc_hs_cmp cmp);
|
||||
/** Sort an array.
|
||||
* @param base start of array
|
||||
* @param count number of elements in array
|
||||
* @param width size of each element
|
||||
* @param cmp compare function
|
||||
* @param swap swap function
|
||||
* @param cookie user pointer passed back to compare function
|
||||
*/
|
||||
void uc_heapsort(void *base, size_t count, size_t width,
|
||||
uc_hs_cmp cmp, uc_hs_swp swap, void *cookie);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user