diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/001_gendata_h48h0k4/gendata_h48h0k4.c | 4 | ||||
| -rw-r--r-- | tools/002_gendata_h48h0k2/gendata_h48h0k2.c | 62 | ||||
| -rw-r--r-- | tools/010_stats_tables_h48/stats_tables_h48.c (renamed from tools/002_stats_tables_h48/stats_tables_h48.c) | 0 | ||||
| -rw-r--r-- | tools/020_solve_small/solve_small.c (renamed from tools/003_solve_small/solve_small.c) | 0 |
4 files changed, 64 insertions, 2 deletions
diff --git a/tools/001_gendata_h48h0k4/gendata_h48h0k4.c b/tools/001_gendata_h48h0k4/gendata_h48h0k4.c index 0926a34..a2c57ca 100644 --- a/tools/001_gendata_h48h0k4/gendata_h48h0k4.c +++ b/tools/001_gendata_h48h0k4/gendata_h48h0k4.c | |||
| @@ -37,12 +37,12 @@ void run(void) { | |||
| 37 | printf("Error generating table\n"); | 37 | printf("Error generating table\n"); |
| 38 | } else { | 38 | } else { |
| 39 | printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); | 39 | printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); |
| 40 | h48info = (uint32_t *)buf + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4; | 40 | h48info = (uint32_t *)buf + 1 + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4; |
| 41 | for (i = 0; i < MAXDEPTH+1 && h48info[i+1]; i++) { | 41 | for (i = 0; i < MAXDEPTH+1 && h48info[i+1]; i++) { |
| 42 | x = h48info[i+1]; | 42 | x = h48info[i+1]; |
| 43 | printf("%d:\t%" PRIu32, i, x); | 43 | printf("%d:\t%" PRIu32, i, x); |
| 44 | if (x != expected[i]) | 44 | if (x != expected[i]) |
| 45 | printf(" <--- Error! Expected: %" PRIu32 "\n", | 45 | printf(" <--- Error! Expected: %" PRIu32, |
| 46 | expected[i]); | 46 | expected[i]); |
| 47 | printf("\n"); | 47 | printf("\n"); |
| 48 | } | 48 | } |
diff --git a/tools/002_gendata_h48h0k2/gendata_h48h0k2.c b/tools/002_gendata_h48h0k2/gendata_h48h0k2.c new file mode 100644 index 0000000..2754f80 --- /dev/null +++ b/tools/002_gendata_h48h0k2/gendata_h48h0k2.c | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | #include "../tool.h" | ||
| 2 | |||
| 3 | #define MAXDEPTH 20 | ||
| 4 | #define HVALUE 0 | ||
| 5 | #define OPTIONS "0;2;20" | ||
| 6 | #define LONGOPTIONS "h = 0, k = 2, max depth = 20" | ||
| 7 | |||
| 8 | #define COCSEPSIZE 1119792 | ||
| 9 | #define ETABLESIZE(h) (((3393 * 495 * 70) >> 2) << (size_t)(h)) | ||
| 10 | |||
| 11 | uint32_t expected[21] = { | ||
| 12 | /* Base value is 8 */ | ||
| 13 | [0] = 5473562, | ||
| 14 | [1] = 34776317, | ||
| 15 | [2] = 68566704, | ||
| 16 | [3] = 8750867, | ||
| 17 | }; | ||
| 18 | |||
| 19 | char *buf; | ||
| 20 | |||
| 21 | void run(void) { | ||
| 22 | uint32_t *h48info, x; | ||
| 23 | int i; | ||
| 24 | int64_t s; | ||
| 25 | |||
| 26 | s = nissy_gendata("h48", OPTIONS, buf); | ||
| 27 | |||
| 28 | if (s == -1) { | ||
| 29 | printf("Error generating table\n"); | ||
| 30 | } else { | ||
| 31 | printf("Succesfully generated %" PRId64 " bytes. Table:\n", s); | ||
| 32 | h48info = (uint32_t *)buf + 1 + (ETABLESIZE(HVALUE) + COCSEPSIZE) / 4; | ||
| 33 | for (i = 0; i < 4; i++) { | ||
| 34 | x = h48info[i+1]; | ||
| 35 | printf("%d:\t%" PRIu32, i, x); | ||
| 36 | if (x != expected[i]) | ||
| 37 | printf(" <--- Error! Expected: %" PRIu32, | ||
| 38 | expected[i]); | ||
| 39 | printf("\n"); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | int main(void) { | ||
| 45 | int64_t size; | ||
| 46 | |||
| 47 | nissy_setlogger(log_stderr); | ||
| 48 | |||
| 49 | size = nissy_datasize("h48", OPTIONS); | ||
| 50 | if (size == -1) { | ||
| 51 | printf("gendata_h48 benchmark: error in datasize\n"); | ||
| 52 | return 1; | ||
| 53 | } | ||
| 54 | |||
| 55 | buf = malloc(size); | ||
| 56 | |||
| 57 | timerun(run, "benchmark gendata_h48 " LONGOPTIONS); | ||
| 58 | |||
| 59 | free(buf); | ||
| 60 | |||
| 61 | return 0; | ||
| 62 | } | ||
diff --git a/tools/002_stats_tables_h48/stats_tables_h48.c b/tools/010_stats_tables_h48/stats_tables_h48.c index 8b65862..8b65862 100644 --- a/tools/002_stats_tables_h48/stats_tables_h48.c +++ b/tools/010_stats_tables_h48/stats_tables_h48.c | |||
diff --git a/tools/003_solve_small/solve_small.c b/tools/020_solve_small/solve_small.c index dee2b55..dee2b55 100644 --- a/tools/003_solve_small/solve_small.c +++ b/tools/020_solve_small/solve_small.c | |||
