aboutsummaryrefslogtreecommitdiff
path: root/tools/001_gendata_h48h0k4/gendata_h48h0k4.c
blob: a9993b8fa41d061262ee1cbe72e2a124ac9735ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "../tool.h"

#define MAXDEPTH 20
#define HVALUE 0
#define OPTIONS "0;4;20"
#define LONGOPTIONS "h = 0, k = 4, max depth = 20"

#define COCSEPSIZE 1119792
#define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (size_t)(h))

uint32_t expected[21] = {
	[0] = 1,
	[1] = 1,
	[2] = 4,
	[3] = 34,
	[4] = 331,
	[5] = 3612,
	[6] = 41605,
	[7] = 474128,
	[8] = 4953846,
	[9] = 34776317,
	[10] = 68566704,
	[11] = 8749194,
	[12] = 1673,
};

char *buf;

void run(void) {
	int64_t s;

	s = nissy_gendata("h48", OPTIONS, buf);

	if (s == -1) {
		printf("Error generating table\n");
	} else {
		nissy_datainfo(buf, write_stdout);
		printf("\n");
		printf("Succesfully generated %" PRId64 " bytes. "
		       "See above for details on the tables.\n", s);

		/* TODO: check that the table is correct */
	}
}

int main(void) {
	int64_t size;

	nissy_setlogger(log_stderr);

	size = nissy_datasize("h48", OPTIONS);
	if (size == -1) {
		printf("gendata_h48 benchmark: error in datasize\n");
		return 1;
	}

	buf = malloc(size);

	timerun(run, "benchmark gendata_h48 " LONGOPTIONS);

	free(buf);

	return 0;
}

Generated with cgit - Back to sebastiano.tronto.net