aboutsummaryrefslogtreecommitdiff
path: root/tools/gendata_h48
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-07-21 08:03:42 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-07-21 08:03:42 +0200
commitce5239e50d800289f516d4d17c37bee4bd77e98f (patch)
treeea7f48a5ac38d1f683dcae7544fab1e61cce2bc9 /tools/gendata_h48
parentf737ec920e56dce05c5bdbb798560b937a499980 (diff)
downloadnissy-core-ce5239e50d800289f516d4d17c37bee4bd77e98f.tar.gz
nissy-core-ce5239e50d800289f516d4d17c37bee4bd77e98f.zip
Added some info and error-checking to gendata tool
Diffstat (limited to 'tools/gendata_h48')
-rw-r--r--tools/gendata_h48/gendata_h48.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/tools/gendata_h48/gendata_h48.c b/tools/gendata_h48/gendata_h48.c
index 3f314aa..0456616 100644
--- a/tools/gendata_h48/gendata_h48.c
+++ b/tools/gendata_h48/gendata_h48.c
@@ -9,10 +9,26 @@
9#define COCSEPSIZE 1119792 9#define COCSEPSIZE 1119792
10#define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (size_t)(h)) 10#define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (size_t)(h))
11 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
12char *buf; 28char *buf;
13 29
14void run(void) { 30void run(void) {
15 uint32_t *h48info; 31 uint32_t *h48info, x;
16 int i; 32 int i;
17 int64_t s; 33 int64_t s;
18 34
@@ -23,8 +39,14 @@ void run(void) {
23 } else { 39 } else {
24 printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); 40 printf("Succesfully generated %" PRId64 " bytes. Table:\n", s);
25 h48info = (uint32_t *)buf + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4; 41 h48info = (uint32_t *)buf + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4;
26 for (i = 0; i < MAXDEPTH+1 && h48info[i+1]; i++) 42 for (i = 0; i < MAXDEPTH+1 && h48info[i+1]; i++) {
27 printf("%d:\t%" PRIu32 "\n", i, h48info[i+1]); 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 }
28 } 50 }
29} 51}
30 52

Generated with cgit - Back to sebastiano.tronto.net