aboutsummaryrefslogtreecommitdiff
path: root/tools/gendata_h48
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-08-05 17:20:44 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-08-05 17:20:44 +0200
commitf148aa65dfe587e7b5d2f48b5005be670788dbe6 (patch)
tree6e2a13a76e702b1833acc5d99f93577ceec0721b /tools/gendata_h48
parentce5239e50d800289f516d4d17c37bee4bd77e98f (diff)
downloadnissy-core-f148aa65dfe587e7b5d2f48b5005be670788dbe6.tar.gz
nissy-core-f148aa65dfe587e7b5d2f48b5005be670788dbe6.zip
Updated README.md, added help command to shell
Diffstat (limited to 'tools/gendata_h48')
-rw-r--r--tools/gendata_h48/gendata_h48.c71
1 files changed, 0 insertions, 71 deletions
diff --git a/tools/gendata_h48/gendata_h48.c b/tools/gendata_h48/gendata_h48.c
deleted file mode 100644
index 0456616..0000000
--- a/tools/gendata_h48/gendata_h48.c
+++ /dev/null
@@ -1,71 +0,0 @@
1#include "../timerun.h"
2#include "../../src/cube.h"
3
4#define MAXDEPTH 20
5#define HVALUE 0
6#define OPTIONS "0;20"
7#define LONGOPTIONS "h = 0, max depth = 20"
8
9#define COCSEPSIZE 1119792
10#define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (size_t)(h))
11
12uint32_t expected[21] = {
13 [0] = 1,
14 [1] = 1,
15 [2] = 4,
16 [3] = 34,
17 [4] = 331,
18 [5] = 3612,
19 [6] = 41605,
20 [7] = 474128,
21 [8] = 4953846,
22 [9] = 34776317,
23 [10] = 68566704,
24 [11] = 8749194,
25 [12] = 1673,
26};
27
28char *buf;
29
30void run(void) {
31 uint32_t *h48info, x;
32 int i;
33 int64_t s;
34
35 s = nissy_gendata("h48", OPTIONS, buf);
36
37 if (s == -1) {
38 printf("Error generating table\n");
39 } else {
40 printf("Succesfully generated %" PRId64 " bytes. Table:\n", s);
41 h48info = (uint32_t *)buf + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4;
42 for (i = 0; i < MAXDEPTH+1 && h48info[i+1]; i++) {
43 x = h48info[i+1];
44 printf("%d:\t%" PRIu32, i, x);
45 if (x != expected[i])
46 printf(" <--- Error! Expected: %" PRIu32 "\n",
47 expected[i]);
48 printf("\n");
49 }
50 }
51}
52
53int main(void) {
54 int64_t size;
55
56 nissy_setlogger(log_stderr);
57
58 size = nissy_datasize("h48", OPTIONS);
59 if (size == -1) {
60 printf("gendata_h48 benchmark: error in datasize\n");
61 return 1;
62 }
63
64 buf = malloc(size);
65
66 timerun(run, "benchmark gendata_h48 " LONGOPTIONS);
67
68 free(buf);
69
70 return 0;
71}

Generated with cgit - Back to sebastiano.tronto.net