X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Ffunctional%2Fqsort.c;h=36c09d15a947535b2f92d8c4cafea9efb07da28b;hb=83e2fb402916e68f213d7809e7fb1c82fbf9294a;hp=5927340d8291196f66463fa6526067373459cc64;hpb=1d2a593c349958e954d04acda50a121c8340ed20;p=libc-test diff --git a/src/functional/qsort.c b/src/functional/qsort.c index 5927340..36c09d1 100644 --- a/src/functional/qsort.c +++ b/src/functional/qsort.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -18,6 +19,12 @@ static int ccmp(const void *a, const void *b) return *(char*)a - *(char*)b; } +static int cmp64(const void *a, const void *b) +{ + const uint64_t *ua = a, *ub = b; + return *ua < *ub ? -1 : *ua != *ub; +} + /* 26 items -- even */ static const char *s[] = { "Bob", "Alice", "John", "Ceres", @@ -50,31 +57,59 @@ static int n_sorted[] = { 93994, 232323, 848405, 879045, 2230404, 3434344, 99405644 }; -static void string_sort(const char **a, const char **a_sorted, int len) +static void str_test(const char **a, const char **a_sorted, int len) { int i; qsort(a, len, sizeof *a, scmp); for (i=0; i