diff options
Diffstat (limited to 'tools/tool.h')
| -rw-r--r-- | tools/tool.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tools/tool.h b/tools/tool.h index 58721a2..77cdf34 100644 --- a/tools/tool.h +++ b/tools/tool.h | |||
| @@ -11,12 +11,12 @@ | |||
| 11 | 11 | ||
| 12 | static void log_stderr(const char *, void *); | 12 | static void log_stderr(const char *, void *); |
| 13 | static double timerun(void (*)(void)); | 13 | static double timerun(void (*)(void)); |
| 14 | static void writetable(const char *, int64_t, const char *); | 14 | static void writetable(const unsigned char *, int64_t, const char *); |
| 15 | static long long int generatetable(const char *, char **, | 15 | static long long int generatetable(const char *, unsigned char **, |
| 16 | char [static NISSY_SIZE_DATAID]); | 16 | char [static NISSY_SIZE_DATAID]); |
| 17 | static long long int derivetable( | 17 | static long long int derivetable( |
| 18 | const char *, const char *, const char *, char **); | 18 | const char *, const char *, const char *, unsigned char **); |
| 19 | static int getdata(const char *, char **, const char *); | 19 | static int getdata(const char *, unsigned char **, const char *); |
| 20 | static void gendata_run(const char *, uint64_t[static 21]); | 20 | static void gendata_run(const char *, uint64_t[static 21]); |
| 21 | static void derivedata_run( | 21 | static void derivedata_run( |
| 22 | const char *, const char *, const char *, const char *); | 22 | const char *, const char *, const char *, const char *); |
| @@ -57,7 +57,7 @@ timerun(void (*run)(void)) | |||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | static void | 59 | static void |
| 60 | writetable(const char *buf, int64_t size, const char *filename) | 60 | writetable(const unsigned char *buf, int64_t size, const char *filename) |
| 61 | { | 61 | { |
| 62 | FILE *f; | 62 | FILE *f; |
| 63 | 63 | ||
| @@ -74,7 +74,7 @@ writetable(const char *buf, int64_t size, const char *filename) | |||
| 74 | static long long int | 74 | static long long int |
| 75 | generatetable( | 75 | generatetable( |
| 76 | const char *solver, | 76 | const char *solver, |
| 77 | char **buf, | 77 | unsigned char **buf, |
| 78 | char dataid[static NISSY_SIZE_DATAID] | 78 | char dataid[static NISSY_SIZE_DATAID] |
| 79 | ) | 79 | ) |
| 80 | { | 80 | { |
| @@ -105,12 +105,13 @@ derivetable( | |||
| 105 | const char *solver_large, | 105 | const char *solver_large, |
| 106 | const char *solver_small, | 106 | const char *solver_small, |
| 107 | const char *filename_large, | 107 | const char *filename_large, |
| 108 | char **buf | 108 | unsigned char **buf |
| 109 | ) | 109 | ) |
| 110 | { | 110 | { |
| 111 | uint8_t h, k; | 111 | uint8_t h, k; |
| 112 | long long int size, gensize; | 112 | long long int size, gensize; |
| 113 | char *fulltable, dataid[NISSY_SIZE_DATAID]; | 113 | char dataid[NISSY_SIZE_DATAID]; |
| 114 | unsigned char *fulltable; | ||
| 114 | 115 | ||
| 115 | if (getdata(solver_large, &fulltable, filename_large) != 0) { | 116 | if (getdata(solver_large, &fulltable, filename_large) != 0) { |
| 116 | printf("Error reading full table.\n"); | 117 | printf("Error reading full table.\n"); |
| @@ -149,7 +150,7 @@ derivetable_error_nofree: | |||
| 149 | static int | 150 | static int |
| 150 | getdata( | 151 | getdata( |
| 151 | const char *solver, | 152 | const char *solver, |
| 152 | char **buf, | 153 | unsigned char **buf, |
| 153 | const char *filename | 154 | const char *filename |
| 154 | ) { | 155 | ) { |
| 155 | long long int size, sizeread; | 156 | long long int size, sizeread; |
| @@ -194,7 +195,8 @@ gendata_run( | |||
| 194 | uint64_t expected[static 21] | 195 | uint64_t expected[static 21] |
| 195 | ) { | 196 | ) { |
| 196 | long long int size; | 197 | long long int size; |
| 197 | char *buf, filename[1024], dataid[NISSY_SIZE_DATAID]; | 198 | char filename[1024], dataid[NISSY_SIZE_DATAID]; |
| 199 | unsigned char *buf; | ||
| 198 | 200 | ||
| 199 | size = generatetable(solver, &buf, dataid); | 201 | size = generatetable(solver, &buf, dataid); |
| 200 | sprintf(filename, "tables/%s", dataid); | 202 | sprintf(filename, "tables/%s", dataid); |
| @@ -227,7 +229,7 @@ derivedata_run( | |||
| 227 | ) | 229 | ) |
| 228 | { | 230 | { |
| 229 | long long int size; | 231 | long long int size; |
| 230 | char *buf; | 232 | unsigned char *buf; |
| 231 | 233 | ||
| 232 | buf = NULL; | 234 | buf = NULL; |
| 233 | size = derivetable(solver_large, solver_small, filename_large, &buf); | 235 | size = derivetable(solver_large, solver_small, filename_large, &buf); |
