aboutsummaryrefslogtreecommitdiff
path: root/tools/000_gendata/gendata.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-27 08:22:55 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-27 08:25:41 +0200
commitcee9856b2cb151f705acf6d27454ec08ef2b9a4e (patch)
tree4616e5c59e01be16e96103f9e9897ef004434eb7 /tools/000_gendata/gendata.c
parent0b32395de2500ad87e15fbb0ff4a852e313037e9 (diff)
parent79500f46632ba50b1640d16983942b940dd7955f (diff)
downloadnissy-core-cee9856b2cb151f705acf6d27454ec08ef2b9a4e.tar.gz
nissy-core-cee9856b2cb151f705acf6d27454ec08ef2b9a4e.zip
Merge branch 'master' of tronto.net:h48
Diffstat (limited to 'tools/000_gendata/gendata.c')
-rw-r--r--tools/000_gendata/gendata.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/000_gendata/gendata.c b/tools/000_gendata/gendata.c
new file mode 100644
index 0000000..90166dd
--- /dev/null
+++ b/tools/000_gendata/gendata.c
@@ -0,0 +1,55 @@
1#include "../tool.h"
2#include "../expected_distributions.h"
3
4char *solver, *options;
5uint64_t *expected;
6
7static void
8run(void) {
9 int64_t size;
10 char *buf, filename[1024];
11
12 getfilename(solver, options, filename);
13 size = generatetable(solver, options, &buf);
14 switch (size) {
15 case -1:
16 return;
17 case -2:
18 goto gendata_run_finish;
19 default:
20 nissy_datainfo(buf, write_stdout);
21 printf("\n");
22 printf("Succesfully generated %" PRId64 " bytes. "
23 "See above for details on the tables.\n", size);
24
25 writetable(buf, size, filename);
26 break;
27 }
28
29gendata_run_finish:
30 free(buf);
31}
32
33int main(int argc, char **argv) {
34 uint8_t h, k;
35 char description[256];
36
37 if (argc < 3) {
38 fprintf(stderr, "Error: not enough arguments. "
39 "A solver and its options must be given.\n");
40 return 1;
41 }
42
43 solver = argv[1];
44 options = argv[2];
45 parse_h48_options(options, &h, &k, NULL);
46 expected = expected_h48[h][k];
47 sprintf(description, "benchmark gendata_h48 h = %" PRIu8
48 ", k = %" PRIu8 "", h, k);
49
50 nissy_setlogger(log_stderr);
51
52 timerun(run, description);
53
54 return 0;
55}

Generated with cgit - Back to sebastiano.tronto.net