blob: 8db94e0eef9277177a6fb943c5bf90ad01704c37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <stddef.h>
#include <stdlib.h>
#include "sorters.h"
const struct sorter sorters[] = {
{ .name = "freebsd", .func = freebsd_qsort },
{ .name = "glibc quicksort", .func = glibc_quicksort },
{ .name = "glibc mergesort", .func = glibc_mergesort },
{ .name = "musl", .func = musl_qsort },
{ .name = "wikisort", .func = wikisort },
{ 0 }
};
void assert_sorted(int *buffer, size_t size)
{
if (!size) return;
int prev = buffer[0];
for (size_t i = 1; i < size; i++) {
if (prev > buffer[i]) abort();
prev = buffer[i];
}
}
|