diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-12 09:58:04 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-12 09:58:04 +0200 |
| commit | 76cc82994c1fbb969ec61d3aede6bd42fda09005 (patch) | |
| tree | 653723d48b48d5fc9be20181b1f6720f624176d5 /tools/001_gendata_h48h0k4 | |
| parent | 10b65003102675bd19c0e5174ff249be2a163bc7 (diff) | |
| download | nissy-core-76cc82994c1fbb969ec61d3aede6bd42fda09005.tar.gz nissy-core-76cc82994c1fbb969ec61d3aede6bd42fda09005.zip | |
Cleanup gendata tools
Diffstat (limited to 'tools/001_gendata_h48h0k4')
| -rw-r--r-- | tools/001_gendata_h48h0k4/gendata_h48h0k4.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/tools/001_gendata_h48h0k4/gendata_h48h0k4.c b/tools/001_gendata_h48h0k4/gendata_h48h0k4.c index a9993b8..ff34bb9 100644 --- a/tools/001_gendata_h48h0k4/gendata_h48h0k4.c +++ b/tools/001_gendata_h48h0k4/gendata_h48h0k4.c | |||
| @@ -1,14 +1,6 @@ | |||
| 1 | #include "../tool.h" | 1 | #include "../tool.h" |
| 2 | 2 | ||
| 3 | #define MAXDEPTH 20 | 3 | uint64_t expected[21] = { |
| 4 | #define HVALUE 0 | ||
| 5 | #define OPTIONS "0;4;20" | ||
| 6 | #define LONGOPTIONS "h = 0, k = 4, max depth = 20" | ||
| 7 | |||
| 8 | #define COCSEPSIZE 1119792 | ||
| 9 | #define ETABLESIZE(h) (((3393 * 495 * 70) >> 1) << (size_t)(h)) | ||
| 10 | |||
| 11 | uint32_t expected[21] = { | ||
| 12 | [0] = 1, | 4 | [0] = 1, |
| 13 | [1] = 1, | 5 | [1] = 1, |
| 14 | [2] = 4, | 6 | [2] = 4, |
| @@ -24,41 +16,14 @@ uint32_t expected[21] = { | |||
| 24 | [12] = 1673, | 16 | [12] = 1673, |
| 25 | }; | 17 | }; |
| 26 | 18 | ||
| 27 | char *buf; | ||
| 28 | |||
| 29 | void run(void) { | 19 | void run(void) { |
| 30 | int64_t s; | 20 | gendata_run("h48", "0;4;20", "tables/h48h0k4", expected); |
| 31 | |||
| 32 | s = nissy_gendata("h48", OPTIONS, buf); | ||
| 33 | |||
| 34 | if (s == -1) { | ||
| 35 | printf("Error generating table\n"); | ||
| 36 | } else { | ||
| 37 | nissy_datainfo(buf, write_stdout); | ||
| 38 | printf("\n"); | ||
| 39 | printf("Succesfully generated %" PRId64 " bytes. " | ||
| 40 | "See above for details on the tables.\n", s); | ||
| 41 | |||
| 42 | /* TODO: check that the table is correct */ | ||
| 43 | } | ||
| 44 | } | 21 | } |
| 45 | 22 | ||
| 46 | int main(void) { | 23 | int main(void) { |
| 47 | int64_t size; | ||
| 48 | |||
| 49 | nissy_setlogger(log_stderr); | 24 | nissy_setlogger(log_stderr); |
| 50 | 25 | ||
| 51 | size = nissy_datasize("h48", OPTIONS); | 26 | timerun(run, "benchmark gendata_h48 h = 0, k = 4"); |
| 52 | if (size == -1) { | ||
| 53 | printf("gendata_h48 benchmark: error in datasize\n"); | ||
| 54 | return 1; | ||
| 55 | } | ||
| 56 | |||
| 57 | buf = malloc(size); | ||
| 58 | |||
| 59 | timerun(run, "benchmark gendata_h48 " LONGOPTIONS); | ||
| 60 | |||
| 61 | free(buf); | ||
| 62 | 27 | ||
| 63 | return 0; | 28 | return 0; |
| 64 | } | 29 | } |
