diff options
Diffstat (limited to 'tools/tool.h')
| -rw-r--r-- | tools/tool.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tools/tool.h b/tools/tool.h index 2fc0224..8fa726a 100644 --- a/tools/tool.h +++ b/tools/tool.h | |||
| @@ -13,8 +13,9 @@ static void log_stderr(const char *, ...); | |||
| 13 | static void log_stdout(const char *, ...); | 13 | static void log_stdout(const char *, ...); |
| 14 | static double timerun(void (*)(void)); | 14 | static double timerun(void (*)(void)); |
| 15 | static void writetable(const char *, int64_t, const char *); | 15 | static void writetable(const char *, int64_t, const char *); |
| 16 | static int64_t generatetable(const char *, char **); | 16 | static long long int generatetable(const char *, char **); |
| 17 | static int64_t derivetable(const char *, const char *, const char *, char **); | 17 | static long long int derivetable( |
| 18 | const char *, const char *, const char *, char **); | ||
| 18 | static int getdata(const char *, char **, const char *); | 19 | static int getdata(const char *, char **, const char *); |
| 19 | static void gendata_run(const char *, uint64_t[static 21]); | 20 | static void gendata_run(const char *, uint64_t[static 21]); |
| 20 | static void derivedata_run( | 21 | static void derivedata_run( |
| @@ -84,10 +85,10 @@ writetable(const char *buf, int64_t size, const char *filename) | |||
| 84 | } | 85 | } |
| 85 | } | 86 | } |
| 86 | 87 | ||
| 87 | static int64_t | 88 | static long long int |
| 88 | generatetable(const char *solver, char **buf) | 89 | generatetable(const char *solver, char **buf) |
| 89 | { | 90 | { |
| 90 | int64_t size, gensize; | 91 | long long int size, gensize; |
| 91 | 92 | ||
| 92 | size = nissy_datasize(solver); | 93 | size = nissy_datasize(solver); |
| 93 | if (size == -1) { | 94 | if (size == -1) { |
| @@ -101,7 +102,7 @@ generatetable(const char *solver, char **buf) | |||
| 101 | if (gensize != size) { | 102 | if (gensize != size) { |
| 102 | printf("Error generating table"); | 103 | printf("Error generating table"); |
| 103 | if (gensize != -1) | 104 | if (gensize != -1) |
| 104 | printf(" (got %" PRId64 " bytes)", gensize); | 105 | printf(" (got %lld bytes)", gensize); |
| 105 | printf("\n"); | 106 | printf("\n"); |
| 106 | return -2; | 107 | return -2; |
| 107 | } | 108 | } |
| @@ -109,7 +110,7 @@ generatetable(const char *solver, char **buf) | |||
| 109 | return gensize; | 110 | return gensize; |
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | static int64_t | 113 | static long long int |
| 113 | derivetable( | 114 | derivetable( |
| 114 | const char *solver_large, | 115 | const char *solver_large, |
| 115 | const char *solver_small, | 116 | const char *solver_small, |
| @@ -118,7 +119,7 @@ derivetable( | |||
| 118 | ) | 119 | ) |
| 119 | { | 120 | { |
| 120 | uint8_t h, k; | 121 | uint8_t h, k; |
| 121 | int64_t size, gensize; | 122 | long long int size, gensize; |
| 122 | char *fulltable; | 123 | char *fulltable; |
| 123 | 124 | ||
| 124 | if (getdata(solver_large, &fulltable, filename_large) != 0) { | 125 | if (getdata(solver_large, &fulltable, filename_large) != 0) { |
| @@ -161,7 +162,7 @@ getdata( | |||
| 161 | char **buf, | 162 | char **buf, |
| 162 | const char *filename | 163 | const char *filename |
| 163 | ) { | 164 | ) { |
| 164 | int64_t size, sizeread; | 165 | long long int size, sizeread; |
| 165 | FILE *f; | 166 | FILE *f; |
| 166 | 167 | ||
| 167 | if ((f = fopen(filename, "rb")) == NULL) { | 168 | if ((f = fopen(filename, "rb")) == NULL) { |
| @@ -201,7 +202,7 @@ gendata_run( | |||
| 201 | const char *solver, | 202 | const char *solver, |
| 202 | uint64_t expected[static 21] | 203 | uint64_t expected[static 21] |
| 203 | ) { | 204 | ) { |
| 204 | int64_t size; | 205 | long long int size; |
| 205 | char *buf, filename[1024]; | 206 | char *buf, filename[1024]; |
| 206 | 207 | ||
| 207 | sprintf(filename, "tables/%s", solver); | 208 | sprintf(filename, "tables/%s", solver); |
| @@ -214,7 +215,7 @@ gendata_run( | |||
| 214 | default: | 215 | default: |
| 215 | nissy_datainfo(size, buf, write_stdout); | 216 | nissy_datainfo(size, buf, write_stdout); |
| 216 | printf("\n"); | 217 | printf("\n"); |
| 217 | printf("Succesfully generated %" PRId64 " bytes. " | 218 | printf("Succesfully generated %lld bytes. " |
| 218 | "See above for details on the tables.\n", size); | 219 | "See above for details on the tables.\n", size); |
| 219 | 220 | ||
| 220 | /* TODO: check that the table is correct */ | 221 | /* TODO: check that the table is correct */ |
| @@ -234,7 +235,7 @@ derivedata_run( | |||
| 234 | const char *filename_small | 235 | const char *filename_small |
| 235 | ) | 236 | ) |
| 236 | { | 237 | { |
| 237 | int64_t size; | 238 | long long int size; |
| 238 | char *buf; | 239 | char *buf; |
| 239 | 240 | ||
| 240 | buf = NULL; | 241 | buf = NULL; |
| @@ -247,7 +248,7 @@ derivedata_run( | |||
| 247 | default: | 248 | default: |
| 248 | nissy_datainfo(size, buf, write_stdout); | 249 | nissy_datainfo(size, buf, write_stdout); |
| 249 | printf("\n"); | 250 | printf("\n"); |
| 250 | printf("Succesfully generated %" PRId64 " bytes. " | 251 | printf("Succesfully generated %lld bytes. " |
| 251 | "See above for details on the tables.\n", size); | 252 | "See above for details on the tables.\n", size); |
| 252 | 253 | ||
| 253 | writetable(buf, size, filename_small); | 254 | writetable(buf, size, filename_small); |
