diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-11 17:01:49 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-11 17:01:49 +0200 |
| commit | e6ff0ce6926fa921a13055c9c35d8e60b691e776 (patch) | |
| tree | 4af98713a2b43cbd229ca081d2dac877c8c36880 /tools/002_gendata_h48h0k2 | |
| parent | dd6078288b5d7af4a4c0cdd1377a2976af569c9a (diff) | |
| download | nissy-core-e6ff0ce6926fa921a13055c9c35d8e60b691e776.tar.gz nissy-core-e6ff0ce6926fa921a13055c9c35d8e60b691e776.zip | |
Finished table refactor
Diffstat (limited to 'tools/002_gendata_h48h0k2')
| -rw-r--r-- | tools/002_gendata_h48h0k2/gendata_h48h0k2.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/tools/002_gendata_h48h0k2/gendata_h48h0k2.c b/tools/002_gendata_h48h0k2/gendata_h48h0k2.c index 2754f80..271d339 100644 --- a/tools/002_gendata_h48h0k2/gendata_h48h0k2.c +++ b/tools/002_gendata_h48h0k2/gendata_h48h0k2.c | |||
| @@ -5,9 +5,6 @@ | |||
| 5 | #define OPTIONS "0;2;20" | 5 | #define OPTIONS "0;2;20" |
| 6 | #define LONGOPTIONS "h = 0, k = 2, max depth = 20" | 6 | #define LONGOPTIONS "h = 0, k = 2, max depth = 20" |
| 7 | 7 | ||
| 8 | #define COCSEPSIZE 1119792 | ||
| 9 | #define ETABLESIZE(h) (((3393 * 495 * 70) >> 2) << (size_t)(h)) | ||
| 10 | |||
| 11 | uint32_t expected[21] = { | 8 | uint32_t expected[21] = { |
| 12 | /* Base value is 8 */ | 9 | /* Base value is 8 */ |
| 13 | [0] = 5473562, | 10 | [0] = 5473562, |
| @@ -19,8 +16,6 @@ uint32_t expected[21] = { | |||
| 19 | char *buf; | 16 | char *buf; |
| 20 | 17 | ||
| 21 | void run(void) { | 18 | void run(void) { |
| 22 | uint32_t *h48info, x; | ||
| 23 | int i; | ||
| 24 | int64_t s; | 19 | int64_t s; |
| 25 | 20 | ||
| 26 | s = nissy_gendata("h48", OPTIONS, buf); | 21 | s = nissy_gendata("h48", OPTIONS, buf); |
| @@ -28,16 +23,12 @@ void run(void) { | |||
| 28 | if (s == -1) { | 23 | if (s == -1) { |
| 29 | printf("Error generating table\n"); | 24 | printf("Error generating table\n"); |
| 30 | } else { | 25 | } else { |
| 31 | printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); | 26 | nissy_datainfo(buf, write_stdout); |
| 32 | h48info = (uint32_t *)buf + 1 + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4; | 27 | printf("\n"); |
| 33 | for (i = 0; i < 4; i++) { | 28 | printf("Succesfully generated %" PRId64 " bytes. " |
| 34 | x = h48info[i+1]; | 29 | "See above for details on the tables.\n", s); |
| 35 | printf("%d:\t%" PRIu32, i, x); | 30 | |
| 36 | if (x != expected[i]) | 31 | /* TODO: check that the table is correct */ |
| 37 | printf(" <--- Error! Expected: %" PRIu32, | ||
| 38 | expected[i]); | ||
| 39 | printf("\n"); | ||
| 40 | } | ||
| 41 | } | 32 | } |
| 42 | } | 33 | } |
| 43 | 34 | ||
