diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 14:33:01 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 14:44:07 +0200 |
| commit | 510a7471348788fccba6b7c4b9f7b7cc9aee6ba9 (patch) | |
| tree | 58df7791242d9a4f52e80da93ad3af20ed5e3528 | |
| parent | 1d9b8acfeece68c4f55d2499d8aed127f98a383c (diff) | |
| download | nissy-core-510a7471348788fccba6b7c4b9f7b7cc9aee6ba9.tar.gz nissy-core-510a7471348788fccba6b7c4b9f7b7cc9aee6ba9.zip | |
Always use unsigned char * for data buffers
Before this commit I was inconsistently using one of void *, char *
and uint8_t *.
40 files changed, 285 insertions, 263 deletions
diff --git a/cpp/nissy.cpp b/cpp/nissy.cpp index 92b10bd..88df0f2 100644 --- a/cpp/nissy.cpp +++ b/cpp/nissy.cpp | |||
| @@ -18,11 +18,12 @@ extern "C" { | |||
| 18 | long long nissy_getcube(long long, long long, long long, long long, | 18 | long long nissy_getcube(long long, long long, long long, long long, |
| 19 | const char *, char *); | 19 | const char *, char *); |
| 20 | long long nissy_solverinfo(const char *, char *); | 20 | long long nissy_solverinfo(const char *, char *); |
| 21 | long long nissy_gendata(const char *, unsigned long long, char *); | 21 | long long nissy_gendata(const char *, unsigned long long, |
| 22 | long long nissy_checkdata(unsigned long long, const char *); | 22 | unsigned char *); |
| 23 | long long nissy_checkdata(unsigned long long, const unsigned char *); | ||
| 23 | long long nissy_solve(const char *, const char *, unsigned, unsigned, | 24 | long long nissy_solve(const char *, const char *, unsigned, unsigned, |
| 24 | unsigned, unsigned, unsigned, unsigned, unsigned long long, | 25 | unsigned, unsigned, unsigned, unsigned, unsigned long long, |
| 25 | const char *, unsigned, char *, long long *); | 26 | const unsigned char *, unsigned, char *, long long *); |
| 26 | long long nissy_countmoves(const char *); | 27 | long long nissy_countmoves(const char *); |
| 27 | long long nissy_setlogger(void (*)(const char *, void *), void *); | 28 | long long nissy_setlogger(void (*)(const char *, void *), void *); |
| 28 | } | 29 | } |
| @@ -156,7 +157,7 @@ namespace nissy { | |||
| 156 | { | 157 | { |
| 157 | data.resize(size); | 158 | data.resize(size); |
| 158 | auto err = nissy_gendata(name.c_str(), | 159 | auto err = nissy_gendata(name.c_str(), |
| 159 | size, reinterpret_cast<char *>(data.data())); | 160 | size, reinterpret_cast<unsigned char *>(data.data())); |
| 160 | return error{err}; | 161 | return error{err}; |
| 161 | } | 162 | } |
| 162 | 163 | ||
| @@ -169,7 +170,7 @@ namespace nissy { | |||
| 169 | error solver::check_data() | 170 | error solver::check_data() |
| 170 | { | 171 | { |
| 171 | auto err_value = nissy_checkdata(data.size(), | 172 | auto err_value = nissy_checkdata(data.size(), |
| 172 | reinterpret_cast<const char *>(data.data())); | 173 | reinterpret_cast<const unsigned char *>(data.data())); |
| 173 | error err{err_value}; | 174 | error err{err_value}; |
| 174 | data_checked = err.ok(); | 175 | data_checked = err.ok(); |
| 175 | return err; | 176 | return err; |
| @@ -199,7 +200,7 @@ namespace nissy { | |||
| 199 | auto err = nissy_solve(cube.to_string().c_str(), | 200 | auto err = nissy_solve(cube.to_string().c_str(), |
| 200 | name.c_str(), niss.value, minmoves, maxmoves, maxsols, | 201 | name.c_str(), niss.value, minmoves, maxmoves, maxsols, |
| 201 | optimal, threads, data.size(), | 202 | optimal, threads, data.size(), |
| 202 | reinterpret_cast<const char *>(data.data()), len, | 203 | reinterpret_cast<const unsigned char *>(data.data()), len, |
| 203 | csols.data(), result.stats.data()); | 204 | csols.data(), result.stats.data()); |
| 204 | result.err = error{err}; | 205 | result.err = error{err}; |
| 205 | 206 | ||
diff --git a/python/nissy_module.c b/python/nissy_module.c index 46570dc..b389297 100644 --- a/python/nissy_module.c +++ b/python/nissy_module.c | |||
| @@ -263,7 +263,8 @@ gendata(PyObject *self, PyObject *args) | |||
| 263 | { | 263 | { |
| 264 | long long size, err; | 264 | long long size, err; |
| 265 | const char *solver; | 265 | const char *solver; |
| 266 | char *buf, dataid[NISSY_SIZE_DATAID]; | 266 | char dataid[NISSY_SIZE_DATAID]; |
| 267 | unsigned char *buf; | ||
| 267 | 268 | ||
| 268 | if (!PyArg_ParseTuple(args, "s", &solver)) | 269 | if (!PyArg_ParseTuple(args, "s", &solver)) |
| 269 | return NULL; | 270 | return NULL; |
| @@ -279,7 +280,7 @@ gendata(PyObject *self, PyObject *args) | |||
| 279 | Py_END_ALLOW_THREADS | 280 | Py_END_ALLOW_THREADS |
| 280 | 281 | ||
| 281 | if (check_error(err)) | 282 | if (check_error(err)) |
| 282 | return PyByteArray_FromStringAndSize(buf, size); | 283 | return PyByteArray_FromStringAndSize((char *)buf, size); |
| 283 | else | 284 | else |
| 284 | return NULL; | 285 | return NULL; |
| 285 | } | 286 | } |
| @@ -303,7 +304,8 @@ checkdata(PyObject *self, PyObject *args) | |||
| 303 | if (!PyArg_ParseTuple(args, "Y", &data)) | 304 | if (!PyArg_ParseTuple(args, "Y", &data)) |
| 304 | return NULL; | 305 | return NULL; |
| 305 | 306 | ||
| 306 | result = nissy_checkdata(data->ob_alloc, data->ob_bytes); | 307 | result = nissy_checkdata( |
| 308 | data->ob_alloc, (unsigned char *)data->ob_bytes); | ||
| 307 | 309 | ||
| 308 | if (check_error(result)) | 310 | if (check_error(result)) |
| 309 | return Py_True; | 311 | return Py_True; |
| @@ -348,8 +350,9 @@ solve(PyObject *self, PyObject *args) | |||
| 348 | 350 | ||
| 349 | Py_BEGIN_ALLOW_THREADS | 351 | Py_BEGIN_ALLOW_THREADS |
| 350 | result = nissy_solve(cube, solver, nissflag, minmoves, maxmoves, | 352 | result = nissy_solve(cube, solver, nissflag, minmoves, maxmoves, |
| 351 | maxsolutions, optimal, threads, data->ob_alloc, data->ob_bytes, | 353 | maxsolutions, optimal, threads, data->ob_alloc, |
| 352 | MAX_SOLUTIONS_SIZE, solutions, stats); | 354 | (unsigned char *)data->ob_bytes, MAX_SOLUTIONS_SIZE, solutions, |
| 355 | stats); | ||
| 353 | Py_END_ALLOW_THREADS | 356 | Py_END_ALLOW_THREADS |
| 354 | 357 | ||
| 355 | if(!check_error(result)) { | 358 | if(!check_error(result)) { |
diff --git a/shell/shell.c b/shell/shell.c index 26b4535..104e7e0 100644 --- a/shell/shell.c +++ b/shell/shell.c | |||
| @@ -360,7 +360,8 @@ gendata_exec(args_t *args) | |||
| 360 | { | 360 | { |
| 361 | int i; | 361 | int i; |
| 362 | FILE *file; | 362 | FILE *file; |
| 363 | char *buf, path[MAX_PATH_LENGTH], dataid[NISSY_SIZE_DATAID]; | 363 | char path[MAX_PATH_LENGTH], dataid[NISSY_SIZE_DATAID]; |
| 364 | unsigned char *buf; | ||
| 364 | int64_t ret, size; | 365 | int64_t ret, size; |
| 365 | size_t written; | 366 | size_t written; |
| 366 | 367 | ||
| @@ -427,7 +428,8 @@ solve_exec(args_t *args) | |||
| 427 | int i; | 428 | int i; |
| 428 | uint8_t nissflag; | 429 | uint8_t nissflag; |
| 429 | FILE *file; | 430 | FILE *file; |
| 430 | char *buf, solutions[SOLUTIONS_BUFFER_SIZE], path[MAX_PATH_LENGTH]; | 431 | char solutions[SOLUTIONS_BUFFER_SIZE], path[MAX_PATH_LENGTH]; |
| 432 | unsigned char *buf; | ||
| 431 | char dataid[NISSY_SIZE_DATAID]; | 433 | char dataid[NISSY_SIZE_DATAID]; |
| 432 | long long stats[NISSY_SIZE_SOLVE_STATS]; | 434 | long long stats[NISSY_SIZE_SOLVE_STATS]; |
| 433 | int64_t ret, gendata_ret, size; | 435 | int64_t ret, gendata_ret, size; |
diff --git a/src/nissy.c b/src/nissy.c index f744fa8..dfa1a90 100644 --- a/src/nissy.c +++ b/src/nissy.c | |||
| @@ -14,14 +14,14 @@ | |||
| 14 | 14 | ||
| 15 | long long parse_h48_solver( | 15 | long long parse_h48_solver( |
| 16 | const char *, uint8_t [static 1], uint8_t [static 1]); | 16 | const char *, uint8_t [static 1], uint8_t [static 1]); |
| 17 | STATIC bool checkdata(const char *, const tableinfo_t [static 1]); | 17 | STATIC bool checkdata(const unsigned char *, const tableinfo_t [static 1]); |
| 18 | STATIC bool distribution_equal(const uint64_t [static INFO_DISTRIBUTION_LEN], | 18 | STATIC bool distribution_equal(const uint64_t [static INFO_DISTRIBUTION_LEN], |
| 19 | const uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t); | 19 | const uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t); |
| 20 | STATIC long long write_result(cube_t, char [static NISSY_SIZE_B32]); | 20 | STATIC long long write_result(cube_t, char [static NISSY_SIZE_B32]); |
| 21 | STATIC size_t my_strnlen(const char *, size_t); | 21 | STATIC size_t my_strnlen(const char *, size_t); |
| 22 | STATIC long long nissy_dataid(const char *, char [static NISSY_SIZE_DATAID]); | 22 | STATIC long long nissy_dataid(const char *, char [static NISSY_SIZE_DATAID]); |
| 23 | STATIC long long nissy_gendata_unsafe( | 23 | STATIC long long nissy_gendata_unsafe( |
| 24 | const char *, unsigned long long, char *); | 24 | const char *, unsigned long long, unsigned char *); |
| 25 | 25 | ||
| 26 | #define GETCUBE_OPTIONS(S, F) { .option = S, .fix = F } | 26 | #define GETCUBE_OPTIONS(S, F) { .option = S, .fix = F } |
| 27 | struct { | 27 | struct { |
| @@ -66,7 +66,7 @@ parse_h48_solver_error: | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | STATIC bool | 68 | STATIC bool |
| 69 | checkdata(const char *buf, const tableinfo_t info[static 1]) | 69 | checkdata(const unsigned char *buf, const tableinfo_t info[static 1]) |
| 70 | { | 70 | { |
| 71 | uint64_t distr[INFO_DISTRIBUTION_LEN]; | 71 | uint64_t distr[INFO_DISTRIBUTION_LEN]; |
| 72 | 72 | ||
| @@ -78,10 +78,10 @@ checkdata(const char *buf, const tableinfo_t info[static 1]) | |||
| 78 | getdistribution_cocsep( | 78 | getdistribution_cocsep( |
| 79 | (uint32_t *)((char *)buf + INFOSIZE), distr); | 79 | (uint32_t *)((char *)buf + INFOSIZE), distr); |
| 80 | } else if (!strncmp(info->solver, "h48", 3)) { | 80 | } else if (!strncmp(info->solver, "h48", 3)) { |
| 81 | getdistribution_h48((uint8_t *)buf + INFOSIZE, distr, | 81 | getdistribution_h48(buf + INFOSIZE, distr, |
| 82 | info->h48h, info->bits); | 82 | info->h48h, info->bits); |
| 83 | } else if (!strncmp(info->solver, "coordinate solver for ", 22)) { | 83 | } else if (!strncmp(info->solver, "coordinate solver for ", 22)) { |
| 84 | getdistribution_coord((uint8_t *)buf + INFOSIZE, | 84 | getdistribution_coord(buf + INFOSIZE, |
| 85 | info->solver + 22, distr); | 85 | info->solver + 22, distr); |
| 86 | } else if (!strncmp(info->solver, "eoesep data for h48", 19)) { | 86 | } else if (!strncmp(info->solver, "eoesep data for h48", 19)) { |
| 87 | return true; | 87 | return true; |
| @@ -366,7 +366,7 @@ nissy_getcube( | |||
| 366 | long long | 366 | long long |
| 367 | nissy_datainfo( | 367 | nissy_datainfo( |
| 368 | uint64_t data_size, | 368 | uint64_t data_size, |
| 369 | const char data[data_size] | 369 | const unsigned char data[data_size] |
| 370 | ) | 370 | ) |
| 371 | { | 371 | { |
| 372 | uint8_t i; | 372 | uint8_t i; |
| @@ -405,8 +405,7 @@ nissy_datainfo( | |||
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | if (info.next != 0) | 407 | if (info.next != 0) |
| 408 | return nissy_datainfo( | 408 | return nissy_datainfo(data_size - info.next, data + info.next); |
| 409 | data_size - info.next, (char *)data + info.next); | ||
| 410 | 409 | ||
| 411 | LOG("\n---------\n"); | 410 | LOG("\n---------\n"); |
| 412 | 411 | ||
| @@ -452,7 +451,7 @@ long long | |||
| 452 | nissy_gendata( | 451 | nissy_gendata( |
| 453 | const char *solver, | 452 | const char *solver, |
| 454 | unsigned long long data_size, | 453 | unsigned long long data_size, |
| 455 | char data[data_size] | 454 | unsigned char data[data_size] |
| 456 | ) | 455 | ) |
| 457 | { | 456 | { |
| 458 | return nissy_gendata_unsafe(solver, data_size, data); | 457 | return nissy_gendata_unsafe(solver, data_size, data); |
| @@ -462,7 +461,7 @@ STATIC long long | |||
| 462 | nissy_gendata_unsafe( | 461 | nissy_gendata_unsafe( |
| 463 | const char *solver, | 462 | const char *solver, |
| 464 | unsigned long long data_size, | 463 | unsigned long long data_size, |
| 465 | char *data | 464 | unsigned char *data |
| 466 | ) | 465 | ) |
| 467 | { | 466 | { |
| 468 | long long parse_ret; | 467 | long long parse_ret; |
| @@ -497,10 +496,9 @@ nissy_gendata_unsafe( | |||
| 497 | long long | 496 | long long |
| 498 | nissy_checkdata( | 497 | nissy_checkdata( |
| 499 | unsigned long long data_size, | 498 | unsigned long long data_size, |
| 500 | const char data[data_size] | 499 | const unsigned char data[data_size] |
| 501 | ) | 500 | ) |
| 502 | { | 501 | { |
| 503 | char *buf; | ||
| 504 | tableinfo_t info; | 502 | tableinfo_t info; |
| 505 | int64_t err; | 503 | int64_t err; |
| 506 | 504 | ||
| @@ -509,7 +507,7 @@ nissy_checkdata( | |||
| 509 | return NISSY_ERROR_DATA; | 507 | return NISSY_ERROR_DATA; |
| 510 | } | 508 | } |
| 511 | 509 | ||
| 512 | for (buf = (char *)data; | 510 | for (const unsigned char *buf = data; |
| 513 | (err = readtableinfo(data_size, buf, &info)) == NISSY_OK; | 511 | (err = readtableinfo(data_size, buf, &info)) == NISSY_OK; |
| 514 | buf += info.next, data_size -= info.next) | 512 | buf += info.next, data_size -= info.next) |
| 515 | { | 513 | { |
| @@ -537,7 +535,7 @@ nissy_solve( | |||
| 537 | unsigned optimal, | 535 | unsigned optimal, |
| 538 | unsigned threads, | 536 | unsigned threads, |
| 539 | unsigned long long data_size, | 537 | unsigned long long data_size, |
| 540 | const char data[data_size], | 538 | const unsigned char data[data_size], |
| 541 | unsigned sols_size, | 539 | unsigned sols_size, |
| 542 | char sols[sols_size], | 540 | char sols[sols_size], |
| 543 | long long stats[static NISSY_SIZE_SOLVE_STATS] | 541 | long long stats[static NISSY_SIZE_SOLVE_STATS] |
diff --git a/src/nissy.h b/src/nissy.h index c23f338..a5b3015 100644 --- a/src/nissy.h +++ b/src/nissy.h | |||
| @@ -329,7 +329,7 @@ long long | |||
| 329 | nissy_gendata( | 329 | nissy_gendata( |
| 330 | const char *solver, | 330 | const char *solver, |
| 331 | unsigned long long data_size, | 331 | unsigned long long data_size, |
| 332 | char data[data_size] | 332 | unsigned char data[data_size] |
| 333 | ); | 333 | ); |
| 334 | 334 | ||
| 335 | /* | 335 | /* |
| @@ -347,7 +347,7 @@ Return values: | |||
| 347 | long long | 347 | long long |
| 348 | nissy_checkdata( | 348 | nissy_checkdata( |
| 349 | unsigned long long data_size, | 349 | unsigned long long data_size, |
| 350 | const char data[data_size] | 350 | const unsigned char data[data_size] |
| 351 | ); | 351 | ); |
| 352 | 352 | ||
| 353 | /* | 353 | /* |
| @@ -395,7 +395,7 @@ nissy_solve( | |||
| 395 | unsigned optimal, | 395 | unsigned optimal, |
| 396 | unsigned threads, | 396 | unsigned threads, |
| 397 | unsigned long long data_size, | 397 | unsigned long long data_size, |
| 398 | const char data[data_size], | 398 | const unsigned char data[data_size], |
| 399 | unsigned sols_size, | 399 | unsigned sols_size, |
| 400 | char sols[sols_size], | 400 | char sols[sols_size], |
| 401 | long long stats[static NISSY_SIZE_SOLVE_STATS] | 401 | long long stats[static NISSY_SIZE_SOLVE_STATS] |
diff --git a/src/solvers/coord/common.h b/src/solvers/coord/common.h index 2eb5ad0..8fd405c 100644 --- a/src/solvers/coord/common.h +++ b/src/solvers/coord/common.h | |||
| @@ -1,25 +1,29 @@ | |||
| 1 | STATIC uint64_t coord_coord_generic( | 1 | STATIC uint64_t coord_coord_generic( |
| 2 | const coord_t [static 1], cube_t, const void *); | 2 | const coord_t [static 1], cube_t, const unsigned char *); |
| 3 | STATIC cube_t coord_cube_generic( | 3 | STATIC cube_t coord_cube_generic( |
| 4 | const coord_t [static 1], uint64_t, const void *); | 4 | const coord_t [static 1], uint64_t, const unsigned char *); |
| 5 | STATIC bool coord_isnasty_generic( | 5 | STATIC bool coord_isnasty_generic( |
| 6 | const coord_t [static 1], uint64_t, const void *); | 6 | const coord_t [static 1], uint64_t, const unsigned char *); |
| 7 | STATIC size_t coord_gendata_generic(const coord_t [static 1], void *); | 7 | STATIC size_t coord_gendata_generic(const coord_t [static 1], unsigned char *); |
| 8 | 8 | ||
| 9 | STATIC void append_coord_name(const coord_t [static 1], char *); | 9 | STATIC void append_coord_name(const coord_t [static 1], char *); |
| 10 | STATIC bool solution_lastqt_cw(const solution_moves_t [static 1]); | 10 | STATIC bool solution_lastqt_cw(const solution_moves_t [static 1]); |
| 11 | STATIC bool coord_can_switch( | 11 | STATIC bool coord_can_switch(const coord_t [static 1], const unsigned char *, |
| 12 | const coord_t [static 1], const void *, size_t n, const uint8_t [n]); | 12 | size_t n, const uint8_t [n]); |
| 13 | 13 | ||
| 14 | STATIC uint64_t | 14 | STATIC uint64_t |
| 15 | coord_coord_generic(const coord_t coord[static 1], cube_t c, const void *data) | 15 | coord_coord_generic( |
| 16 | const coord_t coord[static 1], | ||
| 17 | cube_t c, | ||
| 18 | const unsigned char *data | ||
| 19 | ) | ||
| 16 | { | 20 | { |
| 17 | const char *datanoinfo; | 21 | const unsigned char *datanoinfo; |
| 18 | const uint32_t *data32; | 22 | const uint32_t *data32; |
| 19 | uint32_t d; | 23 | uint32_t d; |
| 20 | cube_t tr; | 24 | cube_t tr; |
| 21 | 25 | ||
| 22 | datanoinfo = (const char *)data + INFOSIZE; | 26 | datanoinfo = data + INFOSIZE; |
| 23 | data32 = (const uint32_t *)datanoinfo; | 27 | data32 = (const uint32_t *)datanoinfo; |
| 24 | d = data32[coord->sym.coord(c)]; | 28 | d = data32[coord->sym.coord(c)]; |
| 25 | tr = transform(c, COORD_TTREP(d)); | 29 | tr = transform(c, COORD_TTREP(d)); |
| @@ -28,13 +32,17 @@ coord_coord_generic(const coord_t coord[static 1], cube_t c, const void *data) | |||
| 28 | } | 32 | } |
| 29 | 33 | ||
| 30 | STATIC cube_t | 34 | STATIC cube_t |
| 31 | coord_cube_generic(const coord_t coord[static 1], uint64_t i, const void *data) | 35 | coord_cube_generic( |
| 36 | const coord_t coord[static 1], | ||
| 37 | uint64_t i, | ||
| 38 | const unsigned char *data | ||
| 39 | ) | ||
| 32 | { | 40 | { |
| 33 | const char *datanoinfo; | 41 | const unsigned char *datanoinfo; |
| 34 | const uint32_t *rep32; | 42 | const uint32_t *rep32; |
| 35 | cube_t c; | 43 | cube_t c; |
| 36 | 44 | ||
| 37 | datanoinfo = (const char *)data + INFOSIZE; | 45 | datanoinfo = data + INFOSIZE; |
| 38 | rep32 = (const uint32_t *)(datanoinfo + 4 * (size_t)coord->sym.max); | 46 | rep32 = (const uint32_t *)(datanoinfo + 4 * (size_t)coord->sym.max); |
| 39 | c = coord->sym.cube(rep32[i / coord->sym.max2]); | 47 | c = coord->sym.cube(rep32[i / coord->sym.max2]); |
| 40 | 48 | ||
| @@ -45,14 +53,14 @@ STATIC bool | |||
| 45 | coord_isnasty_generic( | 53 | coord_isnasty_generic( |
| 46 | const coord_t coord[static 1], | 54 | const coord_t coord[static 1], |
| 47 | uint64_t i, | 55 | uint64_t i, |
| 48 | const void *data | 56 | const unsigned char *data |
| 49 | ) | 57 | ) |
| 50 | { | 58 | { |
| 51 | const char *datanoinfo; | 59 | const unsigned char *datanoinfo; |
| 52 | const uint32_t *classttrep, *rep32; | 60 | const uint32_t *classttrep, *rep32; |
| 53 | uint32_t r; | 61 | uint32_t r; |
| 54 | 62 | ||
| 55 | datanoinfo = (const char *)data + INFOSIZE; | 63 | datanoinfo = data + INFOSIZE; |
| 56 | classttrep = (const uint32_t *)datanoinfo; | 64 | classttrep = (const uint32_t *)datanoinfo; |
| 57 | rep32 = (const uint32_t *)(datanoinfo + 4 * (size_t)coord->sym.max); | 65 | rep32 = (const uint32_t *)(datanoinfo + 4 * (size_t)coord->sym.max); |
| 58 | r = rep32[i / coord->sym.max2]; | 66 | r = rep32[i / coord->sym.max2]; |
| @@ -63,11 +71,11 @@ coord_isnasty_generic( | |||
| 63 | STATIC size_t | 71 | STATIC size_t |
| 64 | coord_gendata_generic( | 72 | coord_gendata_generic( |
| 65 | const coord_t coord[static 1], | 73 | const coord_t coord[static 1], |
| 66 | void *data | 74 | unsigned char *data |
| 67 | ) | 75 | ) |
| 68 | { | 76 | { |
| 69 | uint64_t i, j, n, t, nasty; | 77 | uint64_t i, j, n, t, nasty; |
| 70 | char *datanoinfo; | 78 | unsigned char *datanoinfo; |
| 71 | uint32_t *classttrep, *rep; | 79 | uint32_t *classttrep, *rep; |
| 72 | size_t coord_datasize; | 80 | size_t coord_datasize; |
| 73 | cube_t c; | 81 | cube_t c; |
| @@ -78,7 +86,7 @@ coord_gendata_generic( | |||
| 78 | if (data == NULL) | 86 | if (data == NULL) |
| 79 | return coord_datasize; | 87 | return coord_datasize; |
| 80 | 88 | ||
| 81 | datanoinfo = (char *)data + INFOSIZE; | 89 | datanoinfo = data + INFOSIZE; |
| 82 | classttrep = (uint32_t *)datanoinfo; | 90 | classttrep = (uint32_t *)datanoinfo; |
| 83 | rep = classttrep + coord->sym.max; | 91 | rep = classttrep + coord->sym.max; |
| 84 | memset(data, 0xFF, coord_datasize); | 92 | memset(data, 0xFF, coord_datasize); |
| @@ -154,7 +162,7 @@ solution_lastqt_cw(const solution_moves_t s[static 1]) | |||
| 154 | STATIC bool | 162 | STATIC bool |
| 155 | coord_can_switch( | 163 | coord_can_switch( |
| 156 | const coord_t coord[static 1], | 164 | const coord_t coord[static 1], |
| 157 | const void *data, | 165 | const unsigned char *data, |
| 158 | size_t n, | 166 | size_t n, |
| 159 | const uint8_t moves[n] | 167 | const uint8_t moves[n] |
| 160 | ) | 168 | ) |
diff --git a/src/solvers/coord/dr.h b/src/solvers/coord/dr.h index 3bc4c6d..e197f8c 100644 --- a/src/solvers/coord/dr.h +++ b/src/solvers/coord/dr.h | |||
| @@ -5,10 +5,10 @@ STATIC uint64_t coord_dreoesep_nosym(cube_t); | |||
| 5 | STATIC cube_t invcoord_dreoesep_nosym(uint64_t); | 5 | STATIC cube_t invcoord_dreoesep_nosym(uint64_t); |
| 6 | STATIC cube_t coordinate_dr_merge(cube_t, cube_t); | 6 | STATIC cube_t coordinate_dr_merge(cube_t, cube_t); |
| 7 | 7 | ||
| 8 | STATIC uint64_t coordinate_dr_coord(cube_t, const void *); | 8 | STATIC uint64_t coordinate_dr_coord(cube_t, const unsigned char *); |
| 9 | STATIC cube_t coordinate_dr_cube(uint64_t, const void *); | 9 | STATIC cube_t coordinate_dr_cube(uint64_t, const unsigned char *); |
| 10 | STATIC bool coordinate_dr_isnasty(uint64_t, const void *); | 10 | STATIC bool coordinate_dr_isnasty(uint64_t, const unsigned char *); |
| 11 | STATIC size_t coordinate_dr_gendata(void *); | 11 | STATIC size_t coordinate_dr_gendata(unsigned char *); |
| 12 | 12 | ||
| 13 | STATIC bool is_eoco_solvable(cube_t); | 13 | STATIC bool is_eoco_solvable(cube_t); |
| 14 | 14 | ||
| @@ -81,25 +81,25 @@ coordinate_dr_merge(cube_t c1, cube_t c2) | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | STATIC uint64_t | 83 | STATIC uint64_t |
| 84 | coordinate_dr_coord(cube_t cube, const void *data) | 84 | coordinate_dr_coord(cube_t cube, const unsigned char *data) |
| 85 | { | 85 | { |
| 86 | return coord_coord_generic(&coordinate_dr, cube, data); | 86 | return coord_coord_generic(&coordinate_dr, cube, data); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | STATIC cube_t | 89 | STATIC cube_t |
| 90 | coordinate_dr_cube(uint64_t i, const void *data) | 90 | coordinate_dr_cube(uint64_t i, const unsigned char *data) |
| 91 | { | 91 | { |
| 92 | return coord_cube_generic(&coordinate_dr, i, data); | 92 | return coord_cube_generic(&coordinate_dr, i, data); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | STATIC bool | 95 | STATIC bool |
| 96 | coordinate_dr_isnasty(uint64_t i, const void *data) | 96 | coordinate_dr_isnasty(uint64_t i, const unsigned char *data) |
| 97 | { | 97 | { |
| 98 | return coord_isnasty_generic(&coordinate_dr, i, data); | 98 | return coord_isnasty_generic(&coordinate_dr, i, data); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | STATIC size_t | 101 | STATIC size_t |
| 102 | coordinate_dr_gendata(void *data) | 102 | coordinate_dr_gendata(unsigned char *data) |
| 103 | { | 103 | { |
| 104 | return coord_gendata_generic(&coordinate_dr, data); | 104 | return coord_gendata_generic(&coordinate_dr, data); |
| 105 | } | 105 | } |
diff --git a/src/solvers/coord/dreo.h b/src/solvers/coord/dreo.h index 37de0d3..2bc8cd1 100644 --- a/src/solvers/coord/dreo.h +++ b/src/solvers/coord/dreo.h | |||
| @@ -4,10 +4,10 @@ STATIC uint64_t coord_dresep_nosym(cube_t); | |||
| 4 | STATIC cube_t invcoord_dresep_nosym(uint64_t); | 4 | STATIC cube_t invcoord_dresep_nosym(uint64_t); |
| 5 | STATIC cube_t coordinate_dreo_merge(cube_t, cube_t); | 5 | STATIC cube_t coordinate_dreo_merge(cube_t, cube_t); |
| 6 | 6 | ||
| 7 | STATIC uint64_t coordinate_dreo_coord(cube_t, const void *); | 7 | STATIC uint64_t coordinate_dreo_coord(cube_t, const unsigned char *); |
| 8 | STATIC cube_t coordinate_dreo_cube(uint64_t, const void *); | 8 | STATIC cube_t coordinate_dreo_cube(uint64_t, const unsigned char *); |
| 9 | STATIC bool coordinate_dreo_isnasty(uint64_t, const void *); | 9 | STATIC bool coordinate_dreo_isnasty(uint64_t, const unsigned char *); |
| 10 | STATIC size_t coordinate_dreo_gendata(void *); | 10 | STATIC size_t coordinate_dreo_gendata(unsigned char *); |
| 11 | 11 | ||
| 12 | STATIC bool is_dreo_solvable(cube_t); | 12 | STATIC bool is_dreo_solvable(cube_t); |
| 13 | 13 | ||
| @@ -63,25 +63,25 @@ coordinate_dreo_merge(cube_t c1, cube_t c2) | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | STATIC uint64_t | 65 | STATIC uint64_t |
| 66 | coordinate_dreo_coord(cube_t cube, const void *data) | 66 | coordinate_dreo_coord(cube_t cube, const unsigned char *data) |
| 67 | { | 67 | { |
| 68 | return coord_coord_generic(&coordinate_dreo, cube, data); | 68 | return coord_coord_generic(&coordinate_dreo, cube, data); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | STATIC cube_t | 71 | STATIC cube_t |
| 72 | coordinate_dreo_cube(uint64_t i, const void *data) | 72 | coordinate_dreo_cube(uint64_t i, const unsigned char *data) |
| 73 | { | 73 | { |
| 74 | return coord_cube_generic(&coordinate_dreo, i, data); | 74 | return coord_cube_generic(&coordinate_dreo, i, data); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | STATIC bool | 77 | STATIC bool |
| 78 | coordinate_dreo_isnasty(uint64_t i, const void *data) | 78 | coordinate_dreo_isnasty(uint64_t i, const unsigned char *data) |
| 79 | { | 79 | { |
| 80 | return coord_isnasty_generic(&coordinate_dreo, i, data); | 80 | return coord_isnasty_generic(&coordinate_dreo, i, data); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | STATIC size_t | 83 | STATIC size_t |
| 84 | coordinate_dreo_gendata(void *data) | 84 | coordinate_dreo_gendata(unsigned char *data) |
| 85 | { | 85 | { |
| 86 | return coord_gendata_generic(&coordinate_dreo, data); | 86 | return coord_gendata_generic(&coordinate_dreo, data); |
| 87 | } | 87 | } |
diff --git a/src/solvers/coord/eo.h b/src/solvers/coord/eo.h index a0685c4..c8faaea 100644 --- a/src/solvers/coord/eo.h +++ b/src/solvers/coord/eo.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | STATIC uint64_t coordinate_eo_coord(cube_t, const void *); | 1 | STATIC uint64_t coordinate_eo_coord(cube_t, const unsigned char *); |
| 2 | STATIC cube_t coordinate_eo_cube(uint64_t, const void *); | 2 | STATIC cube_t coordinate_eo_cube(uint64_t, const unsigned char *); |
| 3 | STATIC bool coordinate_eo_isnasty(uint64_t, const void *); | 3 | STATIC bool coordinate_eo_isnasty(uint64_t, const unsigned char *); |
| 4 | STATIC size_t coordinate_eo_gendata(void *); | 4 | STATIC size_t coordinate_eo_gendata(unsigned char *); |
| 5 | STATIC bool is_eo_even(cube_t); | 5 | STATIC bool is_eo_even(cube_t); |
| 6 | 6 | ||
| 7 | STATIC coord_t coordinate_eo = { | 7 | STATIC coord_t coordinate_eo = { |
| @@ -24,13 +24,13 @@ STATIC coord_t coordinate_eo = { | |||
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | STATIC uint64_t | 26 | STATIC uint64_t |
| 27 | coordinate_eo_coord(cube_t c, const void *data) | 27 | coordinate_eo_coord(cube_t c, const unsigned char *data) |
| 28 | { | 28 | { |
| 29 | return (uint64_t)coord_eo(c); | 29 | return (uint64_t)coord_eo(c); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | STATIC cube_t | 32 | STATIC cube_t |
| 33 | coordinate_eo_cube(uint64_t c, const void *data) | 33 | coordinate_eo_cube(uint64_t c, const unsigned char *data) |
| 34 | { | 34 | { |
| 35 | cube_t cube = SOLVED_CUBE; | 35 | cube_t cube = SOLVED_CUBE; |
| 36 | set_eo(&cube, (int64_t)c); | 36 | set_eo(&cube, (int64_t)c); |
| @@ -38,13 +38,13 @@ coordinate_eo_cube(uint64_t c, const void *data) | |||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | STATIC bool | 40 | STATIC bool |
| 41 | coordinate_eo_isnasty(uint64_t c, const void *data) | 41 | coordinate_eo_isnasty(uint64_t c, const unsigned char *data) |
| 42 | { | 42 | { |
| 43 | return false; | 43 | return false; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | STATIC size_t | 46 | STATIC size_t |
| 47 | coordinate_eo_gendata(void *data) | 47 | coordinate_eo_gendata(unsigned char *data) |
| 48 | { | 48 | { |
| 49 | return 0; | 49 | return 0; |
| 50 | } | 50 | } |
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index ae7b39e..7a974f8 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -1,21 +1,21 @@ | |||
| 1 | STATIC size_t gendata_coord(const coord_t [static 1], void *); | 1 | STATIC size_t gendata_coord(const coord_t [static 1], unsigned char *); |
| 2 | STATIC int64_t gendata_coord_dispatch(const char *, void *); | 2 | STATIC int64_t gendata_coord_dispatch(const char *, unsigned char *); |
| 3 | STATIC tableinfo_t genptable_coord( | 3 | STATIC tableinfo_t genptable_coord( |
| 4 | const coord_t [static 1], const void *, uint8_t *); | 4 | const coord_t [static 1], const unsigned char *, unsigned char *); |
| 5 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); | 5 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); |
| 6 | STATIC uint64_t genptable_coord_fillneighbors( | 6 | STATIC uint64_t genptable_coord_fillneighbors(const coord_t [static 1], |
| 7 | const coord_t [static 1], const void *, uint64_t, uint8_t, uint8_t *); | 7 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| 8 | STATIC uint64_t genptable_coord_fillfromnew( | 8 | STATIC uint64_t genptable_coord_fillfromnew(const coord_t [static 1], |
| 9 | const coord_t [static 1], const void *, uint64_t, uint8_t, uint8_t *); | 9 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| 10 | STATIC void getdistribution_coord( | 10 | STATIC void getdistribution_coord(const unsigned char *, const char *, |
| 11 | const uint8_t *, const char *, uint64_t [static INFO_DISTRIBUTION_LEN]); | 11 | uint64_t [static INFO_DISTRIBUTION_LEN]); |
| 12 | STATIC uint8_t get_coord_pval( | 12 | STATIC uint8_t get_coord_pval( |
| 13 | const coord_t [static 1], const uint8_t *, uint64_t); | 13 | const coord_t [static 1], const unsigned char *, uint64_t); |
| 14 | STATIC void set_coord_pval( | 14 | STATIC void set_coord_pval( |
| 15 | const coord_t [static 1], uint8_t *, uint64_t, uint8_t); | 15 | const coord_t [static 1], unsigned char *, uint64_t, uint8_t); |
| 16 | 16 | ||
| 17 | STATIC int64_t | 17 | STATIC int64_t |
| 18 | gendata_coord_dispatch(const char *coordstr, void *buf) | 18 | gendata_coord_dispatch(const char *coordstr, unsigned char *buf) |
| 19 | { | 19 | { |
| 20 | coord_t *coord; | 20 | coord_t *coord; |
| 21 | 21 | ||
| @@ -30,14 +30,14 @@ gendata_coord_dispatch(const char *coordstr, void *buf) | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | STATIC size_t | 32 | STATIC size_t |
| 33 | gendata_coord(const coord_t coord[static 1], void *buf) | 33 | gendata_coord(const coord_t coord[static 1], unsigned char *buf) |
| 34 | { | 34 | { |
| 35 | uint64_t coord_dsize, tablesize, ninfo; | 35 | uint64_t coord_dsize, tablesize, ninfo; |
| 36 | void *pruningbuf, *coord_data; | 36 | unsigned char *pruningbuf, *coord_data; |
| 37 | uint8_t *table; | 37 | unsigned char *table; |
| 38 | tableinfo_t coord_data_info, pruning_info; | 38 | tableinfo_t coord_data_info, pruning_info; |
| 39 | 39 | ||
| 40 | coord_data = buf == NULL ? NULL : ((uint8_t *)buf) + INFOSIZE; | 40 | coord_data = buf == NULL ? NULL : buf + INFOSIZE; |
| 41 | coord_dsize = coord->gendata(coord_data); | 41 | coord_dsize = coord->gendata(coord_data); |
| 42 | if (coord_dsize == SIZE_MAX) | 42 | if (coord_dsize == SIZE_MAX) |
| 43 | goto gendata_coord_error; | 43 | goto gendata_coord_error; |
| @@ -69,12 +69,12 @@ gendata_coord(const coord_t coord[static 1], void *buf) | |||
| 69 | 69 | ||
| 70 | writetableinfo(&coord_data_info, INFOSIZE + coord_dsize, buf); | 70 | writetableinfo(&coord_data_info, INFOSIZE + coord_dsize, buf); |
| 71 | 71 | ||
| 72 | pruningbuf = ((uint8_t *)buf) + INFOSIZE + coord_dsize; | 72 | pruningbuf = buf + INFOSIZE + coord_dsize; |
| 73 | } else { | 73 | } else { |
| 74 | pruningbuf = buf; | 74 | pruningbuf = buf; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | table = ((uint8_t *)pruningbuf) + INFOSIZE; | 77 | table = pruningbuf + INFOSIZE; |
| 78 | pruning_info = genptable_coord(coord, coord_data, table); | 78 | pruning_info = genptable_coord(coord, coord_data, table); |
| 79 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); | 79 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); |
| 80 | 80 | ||
| @@ -89,8 +89,8 @@ gendata_coord_error: | |||
| 89 | STATIC tableinfo_t | 89 | STATIC tableinfo_t |
| 90 | genptable_coord( | 90 | genptable_coord( |
| 91 | const coord_t coord[static 1], | 91 | const coord_t coord[static 1], |
| 92 | const void *data, | 92 | const unsigned char *data, |
| 93 | uint8_t *table | 93 | unsigned char *table |
| 94 | ) | 94 | ) |
| 95 | { | 95 | { |
| 96 | uint64_t tablesize, i, d, tot, t, nm; | 96 | uint64_t tablesize, i, d, tot, t, nm; |
| @@ -161,10 +161,10 @@ switch_to_fromnew(uint64_t done, uint64_t max, uint64_t nm) | |||
| 161 | STATIC uint64_t | 161 | STATIC uint64_t |
| 162 | genptable_coord_fillneighbors( | 162 | genptable_coord_fillneighbors( |
| 163 | const coord_t coord[static 1], | 163 | const coord_t coord[static 1], |
| 164 | const void *data, | 164 | const unsigned char *data, |
| 165 | uint64_t i, | 165 | uint64_t i, |
| 166 | uint8_t d, | 166 | uint8_t d, |
| 167 | uint8_t *table | 167 | unsigned char *table |
| 168 | ) | 168 | ) |
| 169 | { | 169 | { |
| 170 | bool isnasty; | 170 | bool isnasty; |
| @@ -198,10 +198,10 @@ genptable_coord_fillneighbors( | |||
| 198 | STATIC uint64_t | 198 | STATIC uint64_t |
| 199 | genptable_coord_fillfromnew( | 199 | genptable_coord_fillfromnew( |
| 200 | const coord_t coord[static 1], | 200 | const coord_t coord[static 1], |
| 201 | const void *data, | 201 | const unsigned char *data, |
| 202 | uint64_t i, | 202 | uint64_t i, |
| 203 | uint8_t d, | 203 | uint8_t d, |
| 204 | uint8_t *table | 204 | unsigned char *table |
| 205 | ) | 205 | ) |
| 206 | { | 206 | { |
| 207 | bool found; | 207 | bool found; |
| @@ -251,7 +251,7 @@ genptable_coord_fillfromnew( | |||
| 251 | 251 | ||
| 252 | STATIC void | 252 | STATIC void |
| 253 | getdistribution_coord( | 253 | getdistribution_coord( |
| 254 | const uint8_t *table, | 254 | const unsigned char *table, |
| 255 | const char *coord, | 255 | const char *coord, |
| 256 | uint64_t distr[static INFO_DISTRIBUTION_LEN] | 256 | uint64_t distr[static INFO_DISTRIBUTION_LEN] |
| 257 | ) | 257 | ) |
| @@ -274,7 +274,7 @@ getdistribution_coord( | |||
| 274 | STATIC uint8_t | 274 | STATIC uint8_t |
| 275 | get_coord_pval( | 275 | get_coord_pval( |
| 276 | const coord_t coord[static 1], | 276 | const coord_t coord[static 1], |
| 277 | const uint8_t *table, | 277 | const unsigned char *table, |
| 278 | uint64_t i | 278 | uint64_t i |
| 279 | ) | 279 | ) |
| 280 | { | 280 | { |
| @@ -284,7 +284,7 @@ get_coord_pval( | |||
| 284 | STATIC void | 284 | STATIC void |
| 285 | set_coord_pval( | 285 | set_coord_pval( |
| 286 | const coord_t coord[static 1], | 286 | const coord_t coord[static 1], |
| 287 | uint8_t *table, | 287 | unsigned char *table, |
| 288 | uint64_t i, | 288 | uint64_t i, |
| 289 | uint8_t val | 289 | uint8_t val |
| 290 | ) | 290 | ) |
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index 072aa27..fb996ac 100644 --- a/src/solvers/coord/solve.h +++ b/src/solvers/coord/solve.h | |||
| @@ -8,16 +8,16 @@ typedef struct { | |||
| 8 | uint8_t nissflag; | 8 | uint8_t nissflag; |
| 9 | bool lastisnormal; | 9 | bool lastisnormal; |
| 10 | coord_t *coord; | 10 | coord_t *coord; |
| 11 | const void *coord_data; | 11 | const unsigned char *coord_data; |
| 12 | const uint8_t *ptable; | 12 | const unsigned char *ptable; |
| 13 | } dfsarg_solve_coord_t; | 13 | } dfsarg_solve_coord_t; |
| 14 | 14 | ||
| 15 | STATIC int64_t solve_coord(cube_t, coord_t [static 1], uint8_t, uint8_t, | 15 | STATIC int64_t solve_coord(cube_t, coord_t [static 1], uint8_t, uint8_t, |
| 16 | uint8_t, uint8_t, uint64_t, uint8_t, uint8_t, uint64_t, const void *, | 16 | uint8_t, uint8_t, uint64_t, uint8_t, uint8_t, uint64_t, |
| 17 | size_t n, char [n]); | 17 | const unsigned char *, size_t n, char [n]); |
| 18 | STATIC int64_t solve_coord_dispatch(cube_t, const char *, uint8_t, uint8_t, | 18 | STATIC int64_t solve_coord_dispatch(cube_t, const char *, uint8_t, uint8_t, |
| 19 | uint8_t, uint64_t, uint8_t, uint8_t, uint64_t, const void *, size_t n, | 19 | uint8_t, uint64_t, uint8_t, uint8_t, uint64_t, const unsigned char *, |
| 20 | char [n]); | 20 | size_t n, char [n]); |
| 21 | STATIC bool coord_solution_admissible(const dfsarg_solve_coord_t [static 1]); | 21 | STATIC bool coord_solution_admissible(const dfsarg_solve_coord_t [static 1]); |
| 22 | STATIC bool solve_coord_dfs_stop(const dfsarg_solve_coord_t [static 1]); | 22 | STATIC bool solve_coord_dfs_stop(const dfsarg_solve_coord_t [static 1]); |
| 23 | STATIC bool coord_continue_onnormal(const dfsarg_solve_coord_t [static 1]); | 23 | STATIC bool coord_continue_onnormal(const dfsarg_solve_coord_t [static 1]); |
| @@ -209,7 +209,7 @@ solve_coord_dispatch( | |||
| 209 | uint8_t optimal, | 209 | uint8_t optimal, |
| 210 | uint8_t threads, | 210 | uint8_t threads, |
| 211 | uint64_t data_size, | 211 | uint64_t data_size, |
| 212 | const void *data, | 212 | const unsigned char *data, |
| 213 | size_t solutions_size, | 213 | size_t solutions_size, |
| 214 | char sols[solutions_size] | 214 | char sols[solutions_size] |
| 215 | ) | 215 | ) |
| @@ -248,7 +248,7 @@ solve_coord( | |||
| 248 | uint8_t optimal, | 248 | uint8_t optimal, |
| 249 | uint8_t threads, | 249 | uint8_t threads, |
| 250 | uint64_t data_size, | 250 | uint64_t data_size, |
| 251 | const void *data, | 251 | const unsigned char *data, |
| 252 | size_t solutions_size, | 252 | size_t solutions_size, |
| 253 | char sols[solutions_size] | 253 | char sols[solutions_size] |
| 254 | ) | 254 | ) |
| @@ -257,8 +257,8 @@ solve_coord( | |||
| 257 | uint8_t t; | 257 | uint8_t t; |
| 258 | int64_t ndepth; | 258 | int64_t ndepth; |
| 259 | cube_t c; | 259 | cube_t c; |
| 260 | const void *coord_data; | 260 | const unsigned char *coord_data; |
| 261 | const uint8_t *ptable; | 261 | const unsigned char *ptable; |
| 262 | dfsarg_solve_coord_t arg; | 262 | dfsarg_solve_coord_t arg; |
| 263 | tableinfo_t info; | 263 | tableinfo_t info; |
| 264 | solution_moves_t solution_moves; | 264 | solution_moves_t solution_moves; |
| @@ -280,11 +280,11 @@ solve_coord( | |||
| 280 | if (info.type == TABLETYPE_PRUNING) { | 280 | if (info.type == TABLETYPE_PRUNING) { |
| 281 | /* Only the pruning table */ | 281 | /* Only the pruning table */ |
| 282 | coord_data = NULL; | 282 | coord_data = NULL; |
| 283 | ptable = (uint8_t *)data + INFOSIZE; | 283 | ptable = data + INFOSIZE; |
| 284 | } else { | 284 | } else { |
| 285 | /* Coordinate has extra data */ | 285 | /* Coordinate has extra data */ |
| 286 | coord_data = (uint8_t *)data + INFOSIZE; | 286 | coord_data = data + INFOSIZE; |
| 287 | ptable = (uint8_t *)data + info.next + INFOSIZE; | 287 | ptable = data + info.next + INFOSIZE; |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | solution_moves_reset(&solution_moves); | 290 | solution_moves_reset(&solution_moves); |
diff --git a/src/solvers/coord/types_macros.h b/src/solvers/coord/types_macros.h index 84ed8eb..2767dcc 100644 --- a/src/solvers/coord/types_macros.h +++ b/src/solvers/coord/types_macros.h | |||
| @@ -16,10 +16,10 @@ | |||
| 16 | 16 | ||
| 17 | typedef struct { | 17 | typedef struct { |
| 18 | const char name[255]; | 18 | const char name[255]; |
| 19 | uint64_t (*coord)(cube_t, const void *); | 19 | uint64_t (*coord)(cube_t, const unsigned char *); |
| 20 | cube_t (*cube)(uint64_t, const void *); | 20 | cube_t (*cube)(uint64_t, const unsigned char *); |
| 21 | bool (*isnasty)(uint64_t, const void *); | 21 | bool (*isnasty)(uint64_t, const unsigned char *); |
| 22 | size_t (*gendata)(void *); | 22 | size_t (*gendata)(unsigned char *); |
| 23 | uint64_t max; | 23 | uint64_t max; |
| 24 | uint32_t moves_mask; | 24 | uint32_t moves_mask; |
| 25 | uint64_t trans_mask; | 25 | uint64_t trans_mask; |
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index f07b71a..2eac383 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | STATIC size_t gendata_cocsep(char *, uint64_t *, cube_t *); | 1 | STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 2 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]); | 2 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]); |
| 3 | STATIC void getdistribution_cocsep( | 3 | STATIC void getdistribution_cocsep( |
| 4 | const uint32_t [static COCSEP_TABLESIZE], uint64_t [static 21]); | 4 | const uint32_t [static COCSEP_TABLESIZE], uint64_t [static 21]); |
| @@ -13,7 +13,7 @@ STATIC_INLINE int8_t get_h48_cdata( | |||
| 13 | 13 | ||
| 14 | STATIC size_t | 14 | STATIC size_t |
| 15 | gendata_cocsep( | 15 | gendata_cocsep( |
| 16 | char *buf, | 16 | unsigned char *buf, |
| 17 | uint64_t *selfsim, | 17 | uint64_t *selfsim, |
| 18 | cube_t *rep | 18 | cube_t *rep |
| 19 | ) | 19 | ) |
diff --git a/src/solvers/h48/gendata_eoesep.h b/src/solvers/h48/gendata_eoesep.h index 4bf5a84..f1e3d4c 100644 --- a/src/solvers/h48/gendata_eoesep.h +++ b/src/solvers/h48/gendata_eoesep.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | STATIC int64_t coord_eoesep_sym(cube_t, const uint32_t [static ESEP_MAX]); | 1 | STATIC int64_t coord_eoesep_sym(cube_t, const uint32_t [static ESEP_MAX]); |
| 2 | STATIC size_t gendata_esep_classes( | 2 | STATIC size_t gendata_esep_classes( |
| 3 | uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); | 3 | uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); |
| 4 | STATIC size_t gendata_eoesep(char *, uint8_t); | 4 | STATIC size_t gendata_eoesep(unsigned char *, uint8_t); |
| 5 | STATIC uint32_t gendata_eoesep_bfs(uint8_t, uint8_t [static EOESEP_BUF], | 5 | STATIC uint32_t gendata_eoesep_bfs(uint8_t, uint8_t [static EOESEP_BUF], |
| 6 | uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); | 6 | uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); |
| 7 | STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [static EOESEP_BUF], | 7 | STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [static EOESEP_BUF], |
| @@ -14,7 +14,7 @@ STATIC bool gendata_eoesep_next(cube_t, uint8_t, | |||
| 14 | uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); | 14 | uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); |
| 15 | STATIC uint8_t get_eoesep_pval( | 15 | STATIC uint8_t get_eoesep_pval( |
| 16 | const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t); | 16 | const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t); |
| 17 | STATIC uint8_t get_eoesep_pval_cube(const void *, cube_t); | 17 | STATIC uint8_t get_eoesep_pval_cube(const unsigned char *, cube_t); |
| 18 | STATIC void set_eoesep_pval( | 18 | STATIC void set_eoesep_pval( |
| 19 | uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t, uint8_t); | 19 | uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t, uint8_t); |
| 20 | 20 | ||
| @@ -67,9 +67,10 @@ gendata_esep_classes( | |||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | STATIC size_t | 69 | STATIC size_t |
| 70 | gendata_eoesep(char *buf, uint8_t maxdepth) | 70 | gendata_eoesep(unsigned char *buf, uint8_t maxdepth) |
| 71 | { | 71 | { |
| 72 | uint8_t *buf8, d; | 72 | uint8_t d; |
| 73 | unsigned char *buf8; | ||
| 73 | uint16_t rep[ESEP_CLASSES]; | 74 | uint16_t rep[ESEP_CLASSES]; |
| 74 | uint32_t *esep_classes, done, level; | 75 | uint32_t *esep_classes, done, level; |
| 75 | int64_t coord; | 76 | int64_t coord; |
| @@ -81,7 +82,7 @@ gendata_eoesep(char *buf, uint8_t maxdepth) | |||
| 81 | LOG("Computing eoesep data\n"); | 82 | LOG("Computing eoesep data\n"); |
| 82 | memset(buf, 0xFF, EOESEP_FULLSIZE); | 83 | memset(buf, 0xFF, EOESEP_FULLSIZE); |
| 83 | esep_classes = (uint32_t *)(buf + INFOSIZE); | 84 | esep_classes = (uint32_t *)(buf + INFOSIZE); |
| 84 | buf8 = (uint8_t *)(buf + INFOSIZE + 4*ESEP_MAX); | 85 | buf8 = buf + INFOSIZE + 4*ESEP_MAX; |
| 85 | gendata_esep_classes(esep_classes, rep); | 86 | gendata_esep_classes(esep_classes, rep); |
| 86 | 87 | ||
| 87 | info = (tableinfo_t) { | 88 | info = (tableinfo_t) { |
| @@ -258,17 +259,13 @@ get_eoesep_pval( | |||
| 258 | } | 259 | } |
| 259 | 260 | ||
| 260 | STATIC uint8_t | 261 | STATIC uint8_t |
| 261 | get_eoesep_pval_cube(const void *data, cube_t c) | 262 | get_eoesep_pval_cube(const unsigned char *data, cube_t c) |
| 262 | { | 263 | { |
| 263 | int64_t coord; | 264 | int64_t coord; |
| 264 | const uint8_t *table; | ||
| 265 | const uint32_t *esep_classes; | ||
| 266 | 265 | ||
| 267 | esep_classes = (const uint32_t *)data; | 266 | coord = coord_eoesep_sym(c, (const uint32_t *)data); |
| 268 | table = (const uint8_t *)data + 4*ESEP_MAX; | ||
| 269 | coord = coord_eoesep_sym(c, esep_classes); | ||
| 270 | 267 | ||
| 271 | return get_eoesep_pval(table, coord); | 268 | return get_eoesep_pval(data + 4*ESEP_MAX, coord); |
| 272 | } | 269 | } |
| 273 | 270 | ||
| 274 | STATIC void | 271 | STATIC void |
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index 18157dc..a878978 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -13,20 +13,20 @@ STATIC_INLINE bool gendata_h48k2_dfs_stop( | |||
| 13 | STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t [static 1]); | 13 | STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t [static 1]); |
| 14 | STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t [static 1]); | 14 | STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t [static 1]); |
| 15 | STATIC void *getdistribution_h48_runthread(void *); | 15 | STATIC void *getdistribution_h48_runthread(void *); |
| 16 | STATIC void getdistribution_h48(const uint8_t *, | 16 | STATIC void getdistribution_h48(const unsigned char *, |
| 17 | uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t, uint8_t); | 17 | uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t, uint8_t); |
| 18 | 18 | ||
| 19 | STATIC const uint32_t *get_cocsepdata_constptr(const void *); | 19 | STATIC const uint32_t *get_cocsepdata_constptr(const unsigned char *); |
| 20 | STATIC const uint8_t *get_h48data_constptr(const void *); | 20 | STATIC const unsigned char *get_h48data_constptr(const unsigned char *); |
| 21 | 21 | ||
| 22 | STATIC_INLINE uint8_t get_h48_pval(const uint8_t *, int64_t, uint8_t); | 22 | STATIC_INLINE uint8_t get_h48_pval(const unsigned char *, int64_t, uint8_t); |
| 23 | STATIC_INLINE void set_h48_pval(uint8_t *, int64_t, uint8_t, uint8_t); | 23 | STATIC_INLINE void set_h48_pval(unsigned char *, int64_t, uint8_t, uint8_t); |
| 24 | STATIC_INLINE uint8_t get_h48_pval_atomic( | 24 | STATIC_INLINE uint8_t get_h48_pval_atomic( |
| 25 | _Atomic const uint8_t *, int64_t, uint8_t); | 25 | _Atomic const unsigned char *, int64_t, uint8_t); |
| 26 | STATIC_INLINE void set_h48_pval_atomic( | 26 | STATIC_INLINE void set_h48_pval_atomic( |
| 27 | _Atomic uint8_t *, int64_t, uint8_t, uint8_t); | 27 | _Atomic unsigned char *, int64_t, uint8_t, uint8_t); |
| 28 | 28 | ||
| 29 | size_t gendata_h48_derive(uint8_t, const void *, void *); | 29 | size_t gendata_h48_derive(uint8_t, const unsigned char *, unsigned char *); |
| 30 | 30 | ||
| 31 | STATIC uint64_t | 31 | STATIC uint64_t |
| 32 | gendata_h48short(gendata_h48short_arg_t arg[static 1]) | 32 | gendata_h48short(gendata_h48short_arg_t arg[static 1]) |
| @@ -67,7 +67,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) | |||
| 67 | { | 67 | { |
| 68 | uint64_t size, cocsepsize, h48size, fallbacksize, fallback2size, of; | 68 | uint64_t size, cocsepsize, h48size, fallbacksize, fallback2size, of; |
| 69 | long long r; | 69 | long long r; |
| 70 | void *cocsepdata_offset; | 70 | unsigned char *cocsepdata_offset; |
| 71 | tableinfo_t cocsepinfo, h48info, fallbackinfo; | 71 | tableinfo_t cocsepinfo, h48info, fallbackinfo; |
| 72 | gendata_h48_arg_t arg_h0k4; | 72 | gendata_h48_arg_t arg_h0k4; |
| 73 | 73 | ||
| @@ -95,9 +95,9 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) | |||
| 95 | 95 | ||
| 96 | gendata_cocsep(arg->buf, arg->selfsim, arg->crep); | 96 | gendata_cocsep(arg->buf, arg->selfsim, arg->crep); |
| 97 | 97 | ||
| 98 | cocsepdata_offset = (char *)arg->buf + INFOSIZE; | 98 | cocsepdata_offset = arg->buf + INFOSIZE; |
| 99 | arg->cocsepdata = (uint32_t *)cocsepdata_offset; | 99 | arg->cocsepdata = (uint32_t *)cocsepdata_offset; |
| 100 | arg->h48buf = (char *)arg->buf + cocsepsize; | 100 | arg->h48buf = (_Atomic unsigned char*)arg->buf + cocsepsize; |
| 101 | 101 | ||
| 102 | arg->base = 99; /* TODO: set this somewhere else */ | 102 | arg->base = 99; /* TODO: set this somewhere else */ |
| 103 | 103 | ||
| @@ -136,8 +136,8 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) | |||
| 136 | arg_h0k4.base = 0; | 136 | arg_h0k4.base = 0; |
| 137 | arg_h0k4.maxdepth = 20; | 137 | arg_h0k4.maxdepth = 20; |
| 138 | arg_h0k4.buf_size = arg->buf_size - h48size; | 138 | arg_h0k4.buf_size = arg->buf_size - h48size; |
| 139 | arg_h0k4.buf = (char *)arg->buf + cocsepsize + h48size; | 139 | arg_h0k4.buf = arg->buf + cocsepsize + h48size; |
| 140 | arg_h0k4.h48buf = (char *)arg->h48buf + h48size; | 140 | arg_h0k4.h48buf = arg->h48buf + h48size; |
| 141 | 141 | ||
| 142 | gendata_h48h0k4(&arg_h0k4); | 142 | gendata_h48h0k4(&arg_h0k4); |
| 143 | 143 | ||
| @@ -145,7 +145,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) | |||
| 145 | 145 | ||
| 146 | /* Add eoesep fallback table */ | 146 | /* Add eoesep fallback table */ |
| 147 | 147 | ||
| 148 | gendata_eoesep((char *)arg->buf + (size - fallback2size), 20); | 148 | gendata_eoesep(arg->buf + (size - fallback2size), 20); |
| 149 | 149 | ||
| 150 | /* Update tableinfo with correct next values */ | 150 | /* Update tableinfo with correct next values */ |
| 151 | 151 | ||
| @@ -157,7 +157,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) | |||
| 157 | } | 157 | } |
| 158 | h48info.next = h48size; | 158 | h48info.next = h48size; |
| 159 | r = writetableinfo(&h48info, | 159 | r = writetableinfo(&h48info, |
| 160 | arg->buf_size - cocsepsize, (char *)arg->buf + cocsepsize); | 160 | arg->buf_size - cocsepsize, arg->buf + cocsepsize); |
| 161 | if (r != NISSY_OK) { | 161 | if (r != NISSY_OK) { |
| 162 | LOG("[H48 gendata] Error: could not write info " | 162 | LOG("[H48 gendata] Error: could not write info " |
| 163 | "for h48 table\n"); | 163 | "for h48 table\n"); |
| @@ -174,8 +174,8 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) | |||
| 174 | 174 | ||
| 175 | of = cocsepsize + h48size; | 175 | of = cocsepsize + h48size; |
| 176 | fallbackinfo.next = fallbacksize; | 176 | fallbackinfo.next = fallbacksize; |
| 177 | r = writetableinfo(&fallbackinfo, | 177 | r = writetableinfo( |
| 178 | arg->buf_size - of, (char *)arg->buf + of); | 178 | &fallbackinfo, arg->buf_size - of, arg->buf + of); |
| 179 | if (r != NISSY_OK) { | 179 | if (r != NISSY_OK) { |
| 180 | LOG("[H48 gendata] Error: could not write info for " | 180 | LOG("[H48 gendata] Error: could not write info for " |
| 181 | "h48 fallback table\n"); | 181 | "h48 fallback table\n"); |
| @@ -189,7 +189,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) | |||
| 189 | STATIC void | 189 | STATIC void |
| 190 | gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) | 190 | gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) |
| 191 | { | 191 | { |
| 192 | _Atomic uint8_t *table; | 192 | _Atomic unsigned char *table; |
| 193 | uint8_t val; | 193 | uint8_t val; |
| 194 | int64_t i, sc, done, d, h48max; | 194 | int64_t i, sc, done, d, h48max; |
| 195 | uint64_t t, tt, isize, cc, bufsize; | 195 | uint64_t t, tt, isize, cc, bufsize; |
| @@ -212,7 +212,7 @@ gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) | |||
| 212 | .next = 0, | 212 | .next = 0, |
| 213 | }; | 213 | }; |
| 214 | 214 | ||
| 215 | table = (_Atomic uint8_t *)arg->h48buf + INFOSIZE; | 215 | table = arg->h48buf + INFOSIZE; |
| 216 | memset(table, 0xFF, H48_TABLESIZE(0, 4)); | 216 | memset(table, 0xFF, H48_TABLESIZE(0, 4)); |
| 217 | 217 | ||
| 218 | h48max = (int64_t)H48_COORDMAX(0); | 218 | h48max = (int64_t)H48_COORDMAX(0); |
| @@ -261,7 +261,7 @@ gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) | |||
| 261 | 261 | ||
| 262 | arg->info.maxvalue = d - 1; | 262 | arg->info.maxvalue = d - 1; |
| 263 | bufsize = arg->buf_size - COCSEP_FULLSIZE; | 263 | bufsize = arg->buf_size - COCSEP_FULLSIZE; |
| 264 | writetableinfo(&arg->info, bufsize, arg->h48buf); | 264 | writetableinfo(&arg->info, bufsize, (unsigned char *)arg->h48buf); |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | STATIC void * | 267 | STATIC void * |
| @@ -374,7 +374,7 @@ gendata_h48k2(gendata_h48_arg_t arg[static 1]) | |||
| 374 | }; | 374 | }; |
| 375 | 375 | ||
| 376 | uint8_t t; | 376 | uint8_t t; |
| 377 | uint8_t *table; | 377 | unsigned char *table; |
| 378 | int64_t j; | 378 | int64_t j; |
| 379 | uint64_t i, ii, inext, count, bufsize; | 379 | uint64_t i, ii, inext, count, bufsize; |
| 380 | h48map_t shortcubes; | 380 | h48map_t shortcubes; |
| @@ -383,7 +383,7 @@ gendata_h48k2(gendata_h48_arg_t arg[static 1]) | |||
| 383 | pthread_t thread[THREADS]; | 383 | pthread_t thread[THREADS]; |
| 384 | pthread_mutex_t shortcubes_mutex, table_mutex[CHUNKS]; | 384 | pthread_mutex_t shortcubes_mutex, table_mutex[CHUNKS]; |
| 385 | 385 | ||
| 386 | table = (uint8_t *)arg->h48buf + INFOSIZE; | 386 | table = (unsigned char *)arg->h48buf + INFOSIZE; |
| 387 | memset(table, 0xFF, H48_TABLESIZE(arg->h, arg->k)); | 387 | memset(table, 0xFF, H48_TABLESIZE(arg->h, arg->k)); |
| 388 | 388 | ||
| 389 | LOG("[H48 gendata] Computing depth <=%" PRIu8 "\n", shortdepth) | 389 | LOG("[H48 gendata] Computing depth <=%" PRIu8 "\n", shortdepth) |
| @@ -439,7 +439,7 @@ gendata_h48k2(gendata_h48_arg_t arg[static 1]) | |||
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | bufsize = arg->buf_size - COCSEP_FULLSIZE; | 441 | bufsize = arg->buf_size - COCSEP_FULLSIZE; |
| 442 | writetableinfo(&arg->info, bufsize, arg->h48buf); | 442 | writetableinfo(&arg->info, bufsize, (unsigned char *)arg->h48buf); |
| 443 | } | 443 | } |
| 444 | 444 | ||
| 445 | STATIC void * | 445 | STATIC void * |
| @@ -653,7 +653,7 @@ STATIC void * | |||
| 653 | getdistribution_h48_runthread(void *arg) | 653 | getdistribution_h48_runthread(void *arg) |
| 654 | { | 654 | { |
| 655 | getdistribution_h48_data_t *data = (getdistribution_h48_data_t *)arg; | 655 | getdistribution_h48_data_t *data = (getdistribution_h48_data_t *)arg; |
| 656 | const uint8_t *table; | 656 | const unsigned char *table; |
| 657 | uint8_t j, k, m; | 657 | uint8_t j, k, m; |
| 658 | int64_t i; | 658 | int64_t i; |
| 659 | 659 | ||
| @@ -671,7 +671,7 @@ getdistribution_h48_runthread(void *arg) | |||
| 671 | 671 | ||
| 672 | STATIC void | 672 | STATIC void |
| 673 | getdistribution_h48( | 673 | getdistribution_h48( |
| 674 | const uint8_t *table, | 674 | const unsigned char *table, |
| 675 | uint64_t distr[static INFO_DISTRIBUTION_LEN], | 675 | uint64_t distr[static INFO_DISTRIBUTION_LEN], |
| 676 | uint8_t h, | 676 | uint8_t h, |
| 677 | uint8_t k | 677 | uint8_t k |
| @@ -708,50 +708,55 @@ getdistribution_h48( | |||
| 708 | } | 708 | } |
| 709 | 709 | ||
| 710 | STATIC const uint32_t * | 710 | STATIC const uint32_t * |
| 711 | get_cocsepdata_constptr(const void *data) | 711 | get_cocsepdata_constptr(const unsigned char *data) |
| 712 | { | 712 | { |
| 713 | return (uint32_t *)((char *)data + INFOSIZE); | 713 | return (uint32_t *)(data + INFOSIZE); |
| 714 | } | 714 | } |
| 715 | 715 | ||
| 716 | STATIC const uint8_t * | 716 | STATIC const unsigned char * |
| 717 | get_h48data_constptr(const void *data) | 717 | get_h48data_constptr(const unsigned char *data) |
| 718 | { | 718 | { |
| 719 | return (uint8_t *)data + COCSEP_FULLSIZE + INFOSIZE; | 719 | return data + COCSEP_FULLSIZE + INFOSIZE; |
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | STATIC_INLINE uint8_t | 722 | STATIC_INLINE uint8_t |
| 723 | get_h48_pval(const uint8_t *table, int64_t i, uint8_t k) | 723 | get_h48_pval(const unsigned char *table, int64_t i, uint8_t k) |
| 724 | { | 724 | { |
| 725 | return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); | 725 | return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | STATIC_INLINE uint8_t | 728 | STATIC_INLINE uint8_t |
| 729 | get_h48_pval_atomic(_Atomic const uint8_t *table, int64_t i, uint8_t k) | 729 | get_h48_pval_atomic(_Atomic const unsigned char *table, int64_t i, uint8_t k) |
| 730 | { | 730 | { |
| 731 | return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); | 731 | return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); |
| 732 | } | 732 | } |
| 733 | 733 | ||
| 734 | STATIC_INLINE void | 734 | STATIC_INLINE void |
| 735 | set_h48_pval(uint8_t *table, int64_t i, uint8_t k, uint8_t val) | 735 | set_h48_pval(unsigned char *table, int64_t i, uint8_t k, uint8_t val) |
| 736 | { | 736 | { |
| 737 | table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k))) | 737 | table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k))) |
| 738 | | (val << H48_SHIFT(i, k)); | 738 | | (val << H48_SHIFT(i, k)); |
| 739 | } | 739 | } |
| 740 | 740 | ||
| 741 | STATIC_INLINE void | 741 | STATIC_INLINE void |
| 742 | set_h48_pval_atomic(_Atomic uint8_t *table, int64_t i, uint8_t k, uint8_t val) | 742 | set_h48_pval_atomic( |
| 743 | _Atomic unsigned char *table, | ||
| 744 | int64_t i, | ||
| 745 | uint8_t k, | ||
| 746 | uint8_t val | ||
| 747 | ) | ||
| 743 | { | 748 | { |
| 744 | table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k))) | 749 | table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k))) |
| 745 | | (val << H48_SHIFT(i, k)); | 750 | | (val << H48_SHIFT(i, k)); |
| 746 | } | 751 | } |
| 747 | 752 | ||
| 748 | size_t | 753 | size_t |
| 749 | gendata_h48_derive(uint8_t h, const void *fulltable, void *buf) | 754 | gendata_h48_derive(uint8_t h, const unsigned char *fulltable, unsigned char *buf) |
| 750 | { | 755 | { |
| 751 | size_t cocsepsize, h48size; | 756 | size_t cocsepsize, h48size; |
| 752 | uint8_t val_full, val_derive; | 757 | uint8_t val_full, val_derive; |
| 753 | const uint8_t *h48full; | 758 | const unsigned char *h48full; |
| 754 | uint8_t *h48derive; | 759 | unsigned char *h48derive; |
| 755 | int64_t i, j, h48max; | 760 | int64_t i, j, h48max; |
| 756 | uint64_t bufsize; | 761 | uint64_t bufsize; |
| 757 | gendata_h48_arg_t arg; | 762 | gendata_h48_arg_t arg; |
| @@ -770,14 +775,14 @@ gendata_h48_derive(uint8_t h, const void *fulltable, void *buf) | |||
| 770 | arg.k = fulltableinfo.bits; | 775 | arg.k = fulltableinfo.bits; |
| 771 | arg.maxdepth = 20; | 776 | arg.maxdepth = 20; |
| 772 | arg.buf = buf; | 777 | arg.buf = buf; |
| 773 | arg.cocsepdata = (uint32_t *)((char *)buf + INFOSIZE); | 778 | arg.cocsepdata = (uint32_t *)(buf + INFOSIZE); |
| 774 | arg.base = fulltableinfo.base; | 779 | arg.base = fulltableinfo.base; |
| 775 | arg.info = makeinfo_h48k2(&arg); | 780 | arg.info = makeinfo_h48k2(&arg); |
| 776 | 781 | ||
| 777 | /* Technically this step is redundant, except that we | 782 | /* Technically this step is redundant, except that we |
| 778 | need selfsim and crep */ | 783 | need selfsim and crep */ |
| 779 | cocsepsize = gendata_cocsep(buf, arg.selfsim, arg.crep); | 784 | cocsepsize = gendata_cocsep(buf, arg.selfsim, arg.crep); |
| 780 | arg.h48buf = (_Atomic uint8_t *)buf + cocsepsize; | 785 | arg.h48buf = (_Atomic unsigned char *)buf + cocsepsize; |
| 781 | h48size = H48_TABLESIZE(h, arg.k) + INFOSIZE; | 786 | h48size = H48_TABLESIZE(h, arg.k) + INFOSIZE; |
| 782 | 787 | ||
| 783 | if (buf == NULL) | 788 | if (buf == NULL) |
| @@ -798,8 +803,8 @@ gendata_h48_derive(uint8_t h, const void *fulltable, void *buf) | |||
| 798 | goto gendata_h48_derive_error; | 803 | goto gendata_h48_derive_error; |
| 799 | } | 804 | } |
| 800 | 805 | ||
| 801 | h48full = (const uint8_t *)fulltable + cocsepsize + INFOSIZE; | 806 | h48full = fulltable + cocsepsize + INFOSIZE; |
| 802 | h48derive = (uint8_t *)arg.h48buf + INFOSIZE; | 807 | h48derive = (unsigned char *)arg.h48buf + INFOSIZE; |
| 803 | memset(h48derive, 0xFF, H48_TABLESIZE(h, arg.k)); | 808 | memset(h48derive, 0xFF, H48_TABLESIZE(h, arg.k)); |
| 804 | memset(arg.info.distribution, 0, | 809 | memset(arg.info.distribution, 0, |
| 805 | INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); | 810 | INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); |
| @@ -819,7 +824,8 @@ gendata_h48_derive(uint8_t h, const void *fulltable, void *buf) | |||
| 819 | getdistribution_h48(h48derive, arg.info.distribution, h, arg.k); | 824 | getdistribution_h48(h48derive, arg.info.distribution, h, arg.k); |
| 820 | 825 | ||
| 821 | bufsize = arg.buf_size - COCSEP_FULLSIZE - INFOSIZE; | 826 | bufsize = arg.buf_size - COCSEP_FULLSIZE - INFOSIZE; |
| 822 | if (writetableinfo(&arg.info, bufsize, arg.h48buf) != NISSY_OK) { | 827 | if (writetableinfo(&arg.info, bufsize, (unsigned char *)arg.h48buf) |
| 828 | != NISSY_OK) { | ||
| 823 | LOG("H48 derive gendata] Error: could not write info " | 829 | LOG("H48 derive gendata] Error: could not write info " |
| 824 | "for table\n"); | 830 | "for table\n"); |
| 825 | goto gendata_h48_derive_error; | 831 | goto gendata_h48_derive_error; |
diff --git a/src/solvers/h48/gendata_types_macros.h b/src/solvers/h48/gendata_types_macros.h index 3f0c666..c4b1b5a 100644 --- a/src/solvers/h48/gendata_types_macros.h +++ b/src/solvers/h48/gendata_types_macros.h | |||
| @@ -55,7 +55,7 @@ typedef struct { | |||
| 55 | uint8_t maxdepth; | 55 | uint8_t maxdepth; |
| 56 | uint16_t *n; | 56 | uint16_t *n; |
| 57 | uint32_t *buf32; | 57 | uint32_t *buf32; |
| 58 | uint8_t *visited; | 58 | unsigned char *visited; |
| 59 | uint64_t *selfsim; | 59 | uint64_t *selfsim; |
| 60 | cube_t *rep; | 60 | cube_t *rep; |
| 61 | } cocsep_dfs_arg_t; | 61 | } cocsep_dfs_arg_t; |
| @@ -67,8 +67,8 @@ typedef struct { | |||
| 67 | uint8_t maxdepth; | 67 | uint8_t maxdepth; |
| 68 | tableinfo_t info; | 68 | tableinfo_t info; |
| 69 | uint64_t buf_size; | 69 | uint64_t buf_size; |
| 70 | void *buf; | 70 | unsigned char *buf; |
| 71 | void *h48buf; | 71 | _Atomic unsigned char *h48buf; |
| 72 | uint32_t *cocsepdata; | 72 | uint32_t *cocsepdata; |
| 73 | uint64_t selfsim[COCSEP_CLASSES]; | 73 | uint64_t selfsim[COCSEP_CLASSES]; |
| 74 | cube_t crep[COCSEP_CLASSES]; | 74 | cube_t crep[COCSEP_CLASSES]; |
| @@ -85,7 +85,7 @@ typedef struct { | |||
| 85 | typedef struct { | 85 | typedef struct { |
| 86 | uint8_t depth; | 86 | uint8_t depth; |
| 87 | uint32_t *cocsepdata; | 87 | uint32_t *cocsepdata; |
| 88 | _Atomic uint8_t *table; | 88 | _Atomic unsigned char *table; |
| 89 | uint64_t *selfsim; | 89 | uint64_t *selfsim; |
| 90 | cube_t *crep; | 90 | cube_t *crep; |
| 91 | uint64_t start; | 91 | uint64_t start; |
| @@ -100,7 +100,7 @@ typedef struct { | |||
| 100 | uint8_t base; | 100 | uint8_t base; |
| 101 | uint8_t shortdepth; | 101 | uint8_t shortdepth; |
| 102 | uint32_t *cocsepdata; | 102 | uint32_t *cocsepdata; |
| 103 | uint8_t *table; | 103 | unsigned char *table; |
| 104 | uint64_t *selfsim; | 104 | uint64_t *selfsim; |
| 105 | cube_t *crep; | 105 | cube_t *crep; |
| 106 | h48map_t *shortcubes; | 106 | h48map_t *shortcubes; |
| @@ -117,8 +117,8 @@ typedef struct { | |||
| 117 | uint8_t k; | 117 | uint8_t k; |
| 118 | uint32_t *cocsepdata; | 118 | uint32_t *cocsepdata; |
| 119 | uint64_t *selfsim; | 119 | uint64_t *selfsim; |
| 120 | uint8_t *table; | 120 | unsigned char *table; |
| 121 | _Atomic uint8_t *table_atomic; | 121 | _Atomic unsigned char *table_atomic; |
| 122 | pthread_mutex_t **table_mutex; | 122 | pthread_mutex_t **table_mutex; |
| 123 | } gendata_h48_mark_t; | 123 | } gendata_h48_mark_t; |
| 124 | 124 | ||
| @@ -127,5 +127,5 @@ typedef struct { | |||
| 127 | int64_t max; | 127 | int64_t max; |
| 128 | uint8_t k; | 128 | uint8_t k; |
| 129 | uint64_t *distr; | 129 | uint64_t *distr; |
| 130 | const uint8_t *table; | 130 | const unsigned char *table; |
| 131 | } getdistribution_h48_data_t; | 131 | } getdistribution_h48_data_t; |
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 0fd419d..cf7095c 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -22,9 +22,9 @@ typedef struct { | |||
| 22 | uint8_t k; | 22 | uint8_t k; |
| 23 | uint8_t base; | 23 | uint8_t base; |
| 24 | const uint32_t *cocsepdata; | 24 | const uint32_t *cocsepdata; |
| 25 | const uint8_t *h48data; | 25 | const unsigned char *h48data; |
| 26 | const uint8_t *h48data_fallback_h0k4; | 26 | const unsigned char *h48data_fallback_h0k4; |
| 27 | const void *h48data_fallback_eoesep; | 27 | const unsigned char *h48data_fallback_eoesep; |
| 28 | uint32_t movemask_normal; | 28 | uint32_t movemask_normal; |
| 29 | uint32_t movemask_inverse; | 29 | uint32_t movemask_inverse; |
| 30 | int64_t nodes_visited; | 30 | int64_t nodes_visited; |
| @@ -53,7 +53,7 @@ STATIC int64_t solve_h48_maketasks( | |||
| 53 | STATIC void *solve_h48_runthread(void *); | 53 | STATIC void *solve_h48_runthread(void *); |
| 54 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); | 54 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); |
| 55 | STATIC int64_t solve_h48(cube_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, | 55 | STATIC int64_t solve_h48(cube_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, |
| 56 | uint64_t, const void *, size_t n, char [n], | 56 | uint64_t, const unsigned char *, size_t n, char [n], |
| 57 | long long [static NISSY_SIZE_SOLVE_STATS]); | 57 | long long [static NISSY_SIZE_SOLVE_STATS]); |
| 58 | 58 | ||
| 59 | STATIC_INLINE bool | 59 | STATIC_INLINE bool |
| @@ -349,7 +349,7 @@ solve_h48( | |||
| 349 | uint8_t optimal, | 349 | uint8_t optimal, |
| 350 | uint8_t threads, | 350 | uint8_t threads, |
| 351 | uint64_t data_size, | 351 | uint64_t data_size, |
| 352 | const void *data, | 352 | const unsigned char *data, |
| 353 | size_t solutions_size, | 353 | size_t solutions_size, |
| 354 | char solutions[solutions_size], | 354 | char solutions[solutions_size], |
| 355 | long long stats[static NISSY_SIZE_SOLVE_STATS] | 355 | long long stats[static NISSY_SIZE_SOLVE_STATS] |
| @@ -365,8 +365,8 @@ solve_h48( | |||
| 365 | int64_t nodes_visited, table_lookups, table_fallbacks; | 365 | int64_t nodes_visited, table_lookups, table_fallbacks; |
| 366 | tableinfo_t info, fbinfo, fbinfo2; | 366 | tableinfo_t info, fbinfo, fbinfo2; |
| 367 | const uint32_t *cocsepdata; | 367 | const uint32_t *cocsepdata; |
| 368 | const uint8_t *fallback, *h48data; | 368 | const unsigned char *fallback, *h48data; |
| 369 | const void *fallback2; | 369 | const unsigned char *fallback2; |
| 370 | solution_moves_t solution_moves[THREADS]; | 370 | solution_moves_t solution_moves[THREADS]; |
| 371 | solution_settings_t settings; | 371 | solution_settings_t settings; |
| 372 | solution_list_t sollist; | 372 | solution_list_t sollist; |
| @@ -379,8 +379,8 @@ solve_h48( | |||
| 379 | if (readtableinfo_n(data_size, data, 2, &info) != NISSY_OK) | 379 | if (readtableinfo_n(data_size, data, 2, &info) != NISSY_OK) |
| 380 | goto solve_h48_error_data; | 380 | goto solve_h48_error_data; |
| 381 | 381 | ||
| 382 | cocsepdata = (uint32_t *)((char *)data + INFOSIZE); | 382 | cocsepdata = (uint32_t *)(data + INFOSIZE); |
| 383 | h48data = (uint8_t *)data + COCSEP_FULLSIZE + INFOSIZE; | 383 | h48data = data + COCSEP_FULLSIZE + INFOSIZE; |
| 384 | 384 | ||
| 385 | /* Read fallback table(s) */ | 385 | /* Read fallback table(s) */ |
| 386 | fallback = NULL; | 386 | fallback = NULL; |
diff --git a/src/solvers/tables.h b/src/solvers/tables.h index db888b5..9147972 100644 --- a/src/solvers/tables.h +++ b/src/solvers/tables.h | |||
| @@ -1,13 +1,14 @@ | |||
| 1 | STATIC uint64_t read_unaligned_u64(const char [static sizeof(uint64_t)]); | 1 | STATIC uint64_t read_unaligned_u64(const unsigned char [static sizeof(uint64_t)]); |
| 2 | STATIC void write_unaligned_u64(char [static sizeof(uint64_t)], uint64_t); | 2 | STATIC void write_unaligned_u64(unsigned char [static sizeof(uint64_t)], uint64_t); |
| 3 | STATIC int64_t readtableinfo(size_t n, const char [n], tableinfo_t [static 1]); | 3 | STATIC int64_t readtableinfo( |
| 4 | size_t n, const unsigned char [n], tableinfo_t [static 1]); | ||
| 4 | STATIC int64_t readtableinfo_n( | 5 | STATIC int64_t readtableinfo_n( |
| 5 | size_t n, const char [n], uint8_t, tableinfo_t [static 1]); | 6 | size_t n, const unsigned char [n], uint8_t, tableinfo_t [static 1]); |
| 6 | STATIC int64_t writetableinfo( | 7 | STATIC int64_t writetableinfo( |
| 7 | const tableinfo_t [static 1], size_t n, char [n]); | 8 | const tableinfo_t [static 1], size_t n, unsigned char [n]); |
| 8 | 9 | ||
| 9 | STATIC uint64_t | 10 | STATIC uint64_t |
| 10 | read_unaligned_u64(const char buf[static sizeof(uint64_t)]) | 11 | read_unaligned_u64(const unsigned char buf[static sizeof(uint64_t)]) |
| 11 | { | 12 | { |
| 12 | uint64_t ret; | 13 | uint64_t ret; |
| 13 | 14 | ||
| @@ -17,7 +18,7 @@ read_unaligned_u64(const char buf[static sizeof(uint64_t)]) | |||
| 17 | } | 18 | } |
| 18 | 19 | ||
| 19 | STATIC void | 20 | STATIC void |
| 20 | write_unaligned_u64(char buf[static sizeof(uint64_t)], uint64_t x) | 21 | write_unaligned_u64(unsigned char buf[static sizeof(uint64_t)], uint64_t x) |
| 21 | { | 22 | { |
| 22 | memcpy(buf, &x, sizeof(uint64_t)); | 23 | memcpy(buf, &x, sizeof(uint64_t)); |
| 23 | } | 24 | } |
| @@ -25,7 +26,7 @@ write_unaligned_u64(char buf[static sizeof(uint64_t)], uint64_t x) | |||
| 25 | STATIC int64_t | 26 | STATIC int64_t |
| 26 | readtableinfo( | 27 | readtableinfo( |
| 27 | size_t buf_size, | 28 | size_t buf_size, |
| 28 | const char buf[buf_size], | 29 | const unsigned char buf[buf_size], |
| 29 | tableinfo_t info[static 1] | 30 | tableinfo_t info[static 1] |
| 30 | ) | 31 | ) |
| 31 | { | 32 | { |
| @@ -69,7 +70,7 @@ readtableinfo( | |||
| 69 | STATIC int64_t | 70 | STATIC int64_t |
| 70 | readtableinfo_n( | 71 | readtableinfo_n( |
| 71 | size_t buf_size, | 72 | size_t buf_size, |
| 72 | const char buf[buf_size], | 73 | const unsigned char buf[buf_size], |
| 73 | uint8_t n, | 74 | uint8_t n, |
| 74 | tableinfo_t info[static 1] | 75 | tableinfo_t info[static 1] |
| 75 | ) | 76 | ) |
| @@ -87,12 +88,12 @@ STATIC int64_t | |||
| 87 | writetableinfo( | 88 | writetableinfo( |
| 88 | const tableinfo_t info[static 1], | 89 | const tableinfo_t info[static 1], |
| 89 | size_t data_size, | 90 | size_t data_size, |
| 90 | char buf[data_size] | 91 | unsigned char buf[data_size] |
| 91 | ) | 92 | ) |
| 92 | { | 93 | { |
| 93 | size_t i; | 94 | size_t i; |
| 94 | bool end; | 95 | bool end; |
| 95 | char *c; | 96 | unsigned char *c; |
| 96 | 97 | ||
| 97 | if (data_size < info->fullsize) { | 98 | if (data_size < info->fullsize) { |
| 98 | LOG("Error writing table: buffer size is too small " | 99 | LOG("Error writing table: buffer size is too small " |
| @@ -125,10 +126,10 @@ writetableinfo( | |||
| 125 | *c = 0; | 126 | *c = 0; |
| 126 | } | 127 | } |
| 127 | 128 | ||
| 128 | *(uint8_t *)OFFSET(buf, INFO_OFFSET_H48H) = info->h48h; | 129 | *OFFSET(buf, INFO_OFFSET_H48H) = (unsigned char)info->h48h; |
| 129 | *(uint8_t *)OFFSET(buf, INFO_OFFSET_BITS) = info->bits; | 130 | *OFFSET(buf, INFO_OFFSET_BITS) = (unsigned char)info->bits; |
| 130 | *(uint8_t *)OFFSET(buf, INFO_OFFSET_BASE) = info->base; | 131 | *OFFSET(buf, INFO_OFFSET_BASE) = (unsigned char)info->base; |
| 131 | *(uint8_t *)OFFSET(buf, INFO_OFFSET_MAXVALUE) = info->maxvalue; | 132 | *OFFSET(buf, INFO_OFFSET_MAXVALUE) = (unsigned char)info->maxvalue; |
| 132 | 133 | ||
| 133 | return NISSY_OK; | 134 | return NISSY_OK; |
| 134 | } | 135 | } |
diff --git a/src/solvers/tables_types_macros.h b/src/solvers/tables_types_macros.h index 465bed1..3db2d25 100644 --- a/src/solvers/tables_types_macros.h +++ b/src/solvers/tables_types_macros.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #define OFFSET(B, K) (((char *)B) + K) | 1 | #define OFFSET(B, K) (((unsigned char *)B) + K) |
| 2 | 2 | ||
| 3 | #define INFOSIZE INT64_C(512) | 3 | #define INFOSIZE INT64_C(512) |
| 4 | #define INFO_SOLVER_STRLEN INT64_C(100) | 4 | #define INFO_SOLVER_STRLEN INT64_C(100) |
diff --git a/test/090_tables_readwrite/tables_readwrite_tests.c b/test/090_tables_readwrite/tables_readwrite_tests.c index 01c1172..3306dd6 100644 --- a/test/090_tables_readwrite/tables_readwrite_tests.c +++ b/test/090_tables_readwrite/tables_readwrite_tests.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | bool readtableinfo(uint64_t, const char *, tableinfo_t *); | 3 | bool readtableinfo(uint64_t, const unsigned char *, tableinfo_t *); |
| 4 | bool writetableinfo(const tableinfo_t *, uint64_t, char *); | 4 | bool writetableinfo(const tableinfo_t *, uint64_t, unsigned char *); |
| 5 | 5 | ||
| 6 | uint64_t readn(void) { | 6 | uint64_t readn(void) { |
| 7 | char str[STRLENMAX]; | 7 | char str[STRLENMAX]; |
| @@ -66,7 +66,7 @@ void test_writeinfo(tableinfo_t info) { | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void run(void) { | 68 | void run(void) { |
| 69 | char buf[INFOSIZE]; | 69 | unsigned char buf[INFOSIZE]; |
| 70 | tableinfo_t expected, actual; | 70 | tableinfo_t expected, actual; |
| 71 | 71 | ||
| 72 | expected = test_readinfo(); | 72 | expected = test_readinfo(); |
diff --git a/test/100_gendata_cocsep/gendata_cocsep_tests.c b/test/100_gendata_cocsep/gendata_cocsep_tests.c index 91ebb52..46b9443 100644 --- a/test/100_gendata_cocsep/gendata_cocsep_tests.c +++ b/test/100_gendata_cocsep/gendata_cocsep_tests.c | |||
| @@ -2,11 +2,11 @@ | |||
| 2 | 2 | ||
| 3 | #define BUF_SIZE 2000000 | 3 | #define BUF_SIZE 2000000 |
| 4 | 4 | ||
| 5 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | 5 | size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 6 | bool readtableinfo(uint64_t, const char *, tableinfo_t *); | 6 | bool readtableinfo(uint64_t, const unsigned char *, tableinfo_t *); |
| 7 | 7 | ||
| 8 | void run(void) { | 8 | void run(void) { |
| 9 | char buf[BUF_SIZE]; | 9 | unsigned char buf[BUF_SIZE]; |
| 10 | uint32_t i; | 10 | uint32_t i; |
| 11 | uint64_t selfsim[COCSEP_CLASSES]; | 11 | uint64_t selfsim[COCSEP_CLASSES]; |
| 12 | cube_t rep[COCSEP_CLASSES]; | 12 | cube_t rep[COCSEP_CLASSES]; |
diff --git a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c index 853586a..b5a74b0 100644 --- a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c +++ b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | 3 | size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 4 | cube_t transform(cube_t, uint8_t); | 4 | cube_t transform(cube_t, uint8_t); |
| 5 | int64_t coord_cocsep(cube_t); | 5 | int64_t coord_cocsep(cube_t); |
| 6 | 6 | ||
| 7 | void run(void) { | 7 | void run(void) { |
| 8 | uint8_t t; | 8 | uint8_t t; |
| 9 | char buf[2000000]; | 9 | unsigned char buf[2000000]; |
| 10 | uint32_t *cocsepdata; | 10 | uint32_t *cocsepdata; |
| 11 | uint64_t selfsim[COCSEP_CLASSES]; | 11 | uint64_t selfsim[COCSEP_CLASSES]; |
| 12 | int64_t coord, tcoord; | 12 | int64_t coord, tcoord; |
diff --git a/test/102_cocsep_selfsim/cocsep_selfsim_tests.c b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c index dd778aa..0ead3b4 100644 --- a/test/102_cocsep_selfsim/cocsep_selfsim_tests.c +++ b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c | |||
| @@ -7,19 +7,19 @@ | |||
| 7 | */ | 7 | */ |
| 8 | #include "../test.h" | 8 | #include "../test.h" |
| 9 | 9 | ||
| 10 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | 10 | size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 11 | int64_t coord_cocsep(cube_t); | 11 | int64_t coord_cocsep(cube_t); |
| 12 | 12 | ||
| 13 | void run(void) { | 13 | void run(void) { |
| 14 | char str[STRLENMAX]; | 14 | char str[STRLENMAX]; |
| 15 | char buf[2000000]; | 15 | unsigned char buf[2000000]; |
| 16 | uint32_t *cocsepdata, data; | 16 | uint32_t *cocsepdata, data; |
| 17 | int64_t coord, coclass; | 17 | int64_t coord, coclass; |
| 18 | uint64_t selfsim[COCSEP_CLASSES], sim, t; | 18 | uint64_t selfsim[COCSEP_CLASSES], sim, t; |
| 19 | cube_t cube, rep[COCSEP_CLASSES]; | 19 | cube_t cube, rep[COCSEP_CLASSES]; |
| 20 | 20 | ||
| 21 | gendata_cocsep(buf, selfsim, rep); | 21 | gendata_cocsep(buf, selfsim, rep); |
| 22 | cocsepdata = (uint32_t *)((char *)buf + INFOSIZE); | 22 | cocsepdata = (uint32_t *)(buf + INFOSIZE); |
| 23 | 23 | ||
| 24 | /* All cases in the same test so we do not generate data many times */ | 24 | /* All cases in the same test so we do not generate data many times */ |
| 25 | 25 | ||
diff --git a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c index a907317..90208eb 100644 --- a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c +++ b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | 3 | size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 4 | int64_t coord_cocsep(cube_t); | 4 | int64_t coord_cocsep(cube_t); |
| 5 | 5 | ||
| 6 | int bcount(uint64_t x) { | 6 | int bcount(uint64_t x) { |
| @@ -15,7 +15,7 @@ int bcount(uint64_t x) { | |||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | void run(void) { | 17 | void run(void) { |
| 18 | char buf[2000000]; | 18 | unsigned char buf[2000000]; |
| 19 | int size[65], tot, j; | 19 | int size[65], tot, j; |
| 20 | uint64_t i, selfsim[COCSEP_CLASSES], sim; | 20 | uint64_t i, selfsim[COCSEP_CLASSES], sim; |
| 21 | cube_t rep[COCSEP_CLASSES]; | 21 | cube_t rep[COCSEP_CLASSES]; |
diff --git a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c index 0b853c3..87975a4 100644 --- a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c +++ b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | uint8_t inverse_trans(uint8_t); | 3 | uint8_t inverse_trans(uint8_t); |
| 4 | cube_t transform_corners(cube_t, uint8_t); | 4 | cube_t transform_corners(cube_t, uint8_t); |
| 5 | int64_t coord_cocsep(cube_t); | 5 | int64_t coord_cocsep(cube_t); |
| 6 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | 6 | size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 7 | 7 | ||
| 8 | void run(void) { | 8 | void run(void) { |
| 9 | uint8_t t; | 9 | uint8_t t; |
| 10 | char buf[2000000]; | 10 | unsigned char buf[2000000]; |
| 11 | uint32_t *cocsepdata, tt; | 11 | uint32_t *cocsepdata, tt; |
| 12 | uint64_t i, selfsim[COCSEP_CLASSES]; | 12 | uint64_t i, selfsim[COCSEP_CLASSES]; |
| 13 | int64_t j, k, l; | 13 | int64_t j, k, l; |
diff --git a/test/105_gendata_eoesep/gendata_eoesep_tests.c b/test/105_gendata_eoesep/gendata_eoesep_tests.c index 62c36bc..0c22d7f 100644 --- a/test/105_gendata_eoesep/gendata_eoesep_tests.c +++ b/test/105_gendata_eoesep/gendata_eoesep_tests.c | |||
| @@ -23,10 +23,10 @@ The test does not generate the full table. For reference, these are the values: | |||
| 23 | #define ISIZE 512 | 23 | #define ISIZE 512 |
| 24 | #define FULLSIZE (ISIZE + (CL*1024) + (4*EMAX)) | 24 | #define FULLSIZE (ISIZE + (CL*1024) + (4*EMAX)) |
| 25 | 25 | ||
| 26 | char buf[FULLSIZE]; | 26 | unsigned char buf[FULLSIZE]; |
| 27 | 27 | ||
| 28 | size_t gendata_eoesep(char [static FULLSIZE], uint8_t); | 28 | size_t gendata_eoesep(unsigned char [static FULLSIZE], uint8_t); |
| 29 | bool readtableinfo(uint64_t, const char *, tableinfo_t *); | 29 | bool readtableinfo(uint64_t, const unsigned char *, tableinfo_t *); |
| 30 | 30 | ||
| 31 | void run(void) { | 31 | void run(void) { |
| 32 | uint32_t i; | 32 | uint32_t i; |
diff --git a/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c index 025ff2b..fdc4619 100644 --- a/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c +++ b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | 3 | size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 4 | int64_t coord_h48(cube_t, const uint32_t *, uint8_t); | 4 | int64_t coord_h48(cube_t, const uint32_t *, uint8_t); |
| 5 | cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); | 5 | cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); |
| 6 | cube_t transform(cube_t, uint8_t); | 6 | cube_t transform(cube_t, uint8_t); |
| @@ -10,14 +10,14 @@ void run(void) { | |||
| 10 | int i; | 10 | int i; |
| 11 | bool found; | 11 | bool found; |
| 12 | uint8_t h, t; | 12 | uint8_t h, t; |
| 13 | char buf[2000000]; | 13 | unsigned char buf[2000000]; |
| 14 | uint32_t *cocsepdata; | 14 | uint32_t *cocsepdata; |
| 15 | uint64_t selfsim[COCSEP_CLASSES]; | 15 | uint64_t selfsim[COCSEP_CLASSES]; |
| 16 | int64_t c, cc; | 16 | int64_t c, cc; |
| 17 | cube_t cube, invc, rep[COCSEP_CLASSES]; | 17 | cube_t cube, invc, rep[COCSEP_CLASSES]; |
| 18 | 18 | ||
| 19 | gendata_cocsep(buf, selfsim, rep); | 19 | gendata_cocsep(buf, selfsim, rep); |
| 20 | cocsepdata = (uint32_t *)((char *)buf + INFOSIZE); | 20 | cocsepdata = (uint32_t *)(buf + INFOSIZE); |
| 21 | 21 | ||
| 22 | i = 1; | 22 | i = 1; |
| 23 | h = 11; | 23 | h = 11; |
diff --git a/test/112_gendata_h48short/gendata_h48short_tests.c b/test/112_gendata_h48short/gendata_h48short_tests.c index 2ed42c1..0de9408 100644 --- a/test/112_gendata_h48short/gendata_h48short_tests.c +++ b/test/112_gendata_h48short/gendata_h48short_tests.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | void h48map_create(h48map_t [static 1], uint64_t, uint64_t); | 5 | void h48map_create(h48map_t [static 1], uint64_t, uint64_t); |
| 6 | void h48map_destroy(h48map_t [static 1]); | 6 | void h48map_destroy(h48map_t [static 1]); |
| 7 | kvpair_t h48map_nextkvpair(h48map_t [static 1], uint64_t [static 1]); | 7 | kvpair_t h48map_nextkvpair(h48map_t [static 1], uint64_t [static 1]); |
| 8 | size_t gendata_cocsep(void *, uint64_t *, cube_t *); | 8 | size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 9 | uint64_t gendata_h48short(gendata_h48short_arg_t [static 1]); | 9 | uint64_t gendata_h48short(gendata_h48short_arg_t [static 1]); |
| 10 | 10 | ||
| 11 | char str[STRLENMAX]; | 11 | char str[STRLENMAX]; |
| @@ -25,7 +25,7 @@ uint64_t readl(void) { | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | void run(void) { | 27 | void run(void) { |
| 28 | char buf[2000000]; | 28 | unsigned char buf[2000000]; |
| 29 | h48map_t map; | 29 | h48map_t map; |
| 30 | uint64_t i, j, capacity, randomizer, selfsim[COCSEP_CLASSES]; | 30 | uint64_t i, j, capacity, randomizer, selfsim[COCSEP_CLASSES]; |
| 31 | kvpair_t kv, b[MAXPOS]; | 31 | kvpair_t kv, b[MAXPOS]; |
diff --git a/test/120_gendata_eo/gendata_eo_tests.c b/test/120_gendata_eo/gendata_eo_tests.c index 46a0606..08c495e 100644 --- a/test/120_gendata_eo/gendata_eo_tests.c +++ b/test/120_gendata_eo/gendata_eo_tests.c | |||
| @@ -15,10 +15,10 @@ Pruning table values (from nissy): | |||
| 15 | #define ISIZE 512 | 15 | #define ISIZE 512 |
| 16 | #define FULLSIZE (ISIZE + 1024) | 16 | #define FULLSIZE (ISIZE + 1024) |
| 17 | 17 | ||
| 18 | char buf[FULLSIZE]; | 18 | unsigned char buf[FULLSIZE]; |
| 19 | 19 | ||
| 20 | size_t gendata_coord_dispatch(const char *, void *); | 20 | size_t gendata_coord_dispatch(const char *, unsigned char *); |
| 21 | bool readtableinfo(uint64_t, const char *, tableinfo_t *); | 21 | bool readtableinfo(uint64_t, const unsigned char *, tableinfo_t *); |
| 22 | 22 | ||
| 23 | void run(void) { | 23 | void run(void) { |
| 24 | uint32_t i; | 24 | uint32_t i; |
diff --git a/test/121_coorddata_dr/coorddata_dr.c b/test/121_coorddata_dr/coorddata_dr.c index 707d605..9432b4c 100644 --- a/test/121_coorddata_dr/coorddata_dr.c +++ b/test/121_coorddata_dr/coorddata_dr.c | |||
| @@ -5,15 +5,15 @@ | |||
| 5 | #define TGROUP UINT64_C(4278190335) | 5 | #define TGROUP UINT64_C(4278190335) |
| 6 | 6 | ||
| 7 | cube_t transform(cube_t, uint8_t); | 7 | cube_t transform(cube_t, uint8_t); |
| 8 | uint64_t coordinate_dr_coord(cube_t, const void *); | 8 | uint64_t coordinate_dr_coord(cube_t, const unsigned char *); |
| 9 | cube_t coordinate_dr_cube(uint64_t, const void *); | 9 | cube_t coordinate_dr_cube(uint64_t, const unsigned char *); |
| 10 | uint64_t coordinate_dr_gendata(void *); | 10 | uint64_t coordinate_dr_gendata(unsigned char *); |
| 11 | 11 | ||
| 12 | void run(void) { | 12 | void run(void) { |
| 13 | bool found; | 13 | bool found; |
| 14 | uint64_t t; | 14 | uint64_t t; |
| 15 | char str[STRLENMAX]; | 15 | char str[STRLENMAX]; |
| 16 | void *data; | 16 | unsigned char *data; |
| 17 | size_t size; | 17 | size_t size; |
| 18 | cube_t cube; | 18 | cube_t cube; |
| 19 | uint64_t coord, coord2; | 19 | uint64_t coord, coord2; |
diff --git a/test/122_coorddata_dreo/coorddata_dreo.c b/test/122_coorddata_dreo/coorddata_dreo.c index 0c75c5e..5c1e796 100644 --- a/test/122_coorddata_dreo/coorddata_dreo.c +++ b/test/122_coorddata_dreo/coorddata_dreo.c | |||
| @@ -5,15 +5,15 @@ | |||
| 5 | #define TGROUP UINT64_C(4278190335) | 5 | #define TGROUP UINT64_C(4278190335) |
| 6 | 6 | ||
| 7 | cube_t transform(cube_t, uint8_t); | 7 | cube_t transform(cube_t, uint8_t); |
| 8 | uint64_t coordinate_dreo_coord(cube_t, const void *); | 8 | uint64_t coordinate_dreo_coord(cube_t, const unsigned char *); |
| 9 | cube_t coordinate_dreo_cube(uint64_t, const void *); | 9 | cube_t coordinate_dreo_cube(uint64_t, const unsigned char *); |
| 10 | uint64_t coordinate_dreo_gendata(void *); | 10 | uint64_t coordinate_dreo_gendata(unsigned char *); |
| 11 | 11 | ||
| 12 | void run(void) { | 12 | void run(void) { |
| 13 | bool found; | 13 | bool found; |
| 14 | uint64_t t; | 14 | uint64_t t; |
| 15 | char str[STRLENMAX]; | 15 | char str[STRLENMAX]; |
| 16 | void *data; | 16 | unsigned char *data; |
| 17 | size_t size; | 17 | size_t size; |
| 18 | cube_t cube; | 18 | cube_t cube; |
| 19 | uint64_t coord, coord2; | 19 | uint64_t coord, coord2; |
diff --git a/tools/000_gendata/gendata.c b/tools/000_gendata/gendata.c index 470fe9b..cd7fb0f 100644 --- a/tools/000_gendata/gendata.c +++ b/tools/000_gendata/gendata.c | |||
| @@ -8,7 +8,8 @@ static void | |||
| 8 | run(void) { | 8 | run(void) { |
| 9 | int64_t size; | 9 | int64_t size; |
| 10 | bool consistent, expected; | 10 | bool consistent, expected; |
| 11 | char *buf, filename[1024], dataid[NISSY_SIZE_DATAID]; | 11 | char filename[1024], dataid[NISSY_SIZE_DATAID]; |
| 12 | unsigned char *buf; | ||
| 12 | 13 | ||
| 13 | size = generatetable(solver, &buf, dataid); | 14 | size = generatetable(solver, &buf, dataid); |
| 14 | switch (size) { | 15 | switch (size) { |
diff --git a/tools/100_checkdata/checkdata.c b/tools/100_checkdata/checkdata.c index cf42cbe..eefb063 100644 --- a/tools/100_checkdata/checkdata.c +++ b/tools/100_checkdata/checkdata.c | |||
| @@ -6,7 +6,8 @@ char *solver, *filename; | |||
| 6 | static void | 6 | static void |
| 7 | run(void) { | 7 | run(void) { |
| 8 | long long int size, result; | 8 | long long int size, result; |
| 9 | char *buf, dataid[NISSY_SIZE_DATAID]; | 9 | char dataid[NISSY_SIZE_DATAID]; |
| 10 | unsigned char *buf; | ||
| 10 | FILE *f; | 11 | FILE *f; |
| 11 | 12 | ||
| 12 | size = nissy_solverinfo(solver, dataid); | 13 | size = nissy_solverinfo(solver, dataid); |
diff --git a/tools/300_solve_small/solve_small.c b/tools/300_solve_small/solve_small.c index d81ed51..2efbcb5 100644 --- a/tools/300_solve_small/solve_small.c +++ b/tools/300_solve_small/solve_small.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | char *solver; | 5 | char *solver; |
| 6 | int64_t size = 0; | 6 | int64_t size = 0; |
| 7 | char *buf; | 7 | unsigned char *buf; |
| 8 | 8 | ||
| 9 | char *scrambles[] = { | 9 | char *scrambles[] = { |
| 10 | /* 12 optimal */ | 10 | /* 12 optimal */ |
diff --git a/tools/301_solve_file/solve_file.c b/tools/301_solve_file/solve_file.c index 110c7d2..fcc018d 100644 --- a/tools/301_solve_file/solve_file.c +++ b/tools/301_solve_file/solve_file.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | char *solver; | 7 | char *solver; |
| 8 | int64_t size = 0, N = 0; | 8 | int64_t size = 0, N = 0; |
| 9 | char *buf; | 9 | unsigned char *buf; |
| 10 | char scrambles[MAX_SCR][MAX_SCR_LEN]; | 10 | char scrambles[MAX_SCR][MAX_SCR_LEN]; |
| 11 | 11 | ||
| 12 | void run(void) { | 12 | void run(void) { |
diff --git a/tools/302_solve_multisol/solve_multisol.c b/tools/302_solve_multisol/solve_multisol.c index e4256de..f6057d7 100644 --- a/tools/302_solve_multisol/solve_multisol.c +++ b/tools/302_solve_multisol/solve_multisol.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | int nsol; | 5 | int nsol; |
| 6 | char *solver; | 6 | char *solver; |
| 7 | int64_t size = 0; | 7 | int64_t size = 0; |
| 8 | char *buf; | 8 | unsigned char *buf; |
| 9 | 9 | ||
| 10 | char *scrambles[] = { | 10 | char *scrambles[] = { |
| 11 | "U2 D2 F2 B2 L2 R2", | 11 | "U2 D2 F2 B2 L2 R2", |
diff --git a/tools/400_solvetest/solve_test.c b/tools/400_solvetest/solve_test.c index a4121a5..a724320 100644 --- a/tools/400_solvetest/solve_test.c +++ b/tools/400_solvetest/solve_test.c | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | char *solver; | 6 | char *solver; |
| 7 | int64_t size = 0; | 7 | int64_t size = 0; |
| 8 | char *buf; | 8 | unsigned char *buf; |
| 9 | |||
| 10 | 9 | ||
| 11 | bool check_one(char *actual, char *expected) { | 10 | bool check_one(char *actual, char *expected) { |
| 12 | unsigned i; | 11 | unsigned i; |
diff --git a/tools/expected_distributions.h b/tools/expected_distributions.h index 7f33335..12faf1d 100644 --- a/tools/expected_distributions.h +++ b/tools/expected_distributions.h | |||
| @@ -197,7 +197,7 @@ check_table(uint64_t *exp, tableinfo_t *info) | |||
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | static bool | 199 | static bool |
| 200 | check_cocsep(size_t data_size, const void *data) | 200 | check_cocsep(size_t data_size, const unsigned char *data) |
| 201 | { | 201 | { |
| 202 | tableinfo_t info; | 202 | tableinfo_t info; |
| 203 | 203 | ||
| @@ -219,7 +219,11 @@ unknown_h48(uint8_t h, uint8_t k) | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | STATIC bool | 221 | STATIC bool |
| 222 | check_distribution(const char *solver, size_t data_size, const void *data) | 222 | check_distribution( |
| 223 | const char *solver, | ||
| 224 | size_t data_size, | ||
| 225 | const unsigned char *data | ||
| 226 | ) | ||
| 223 | { | 227 | { |
| 224 | const char *str; | 228 | const char *str; |
| 225 | tableinfo_t info = {0}; | 229 | tableinfo_t info = {0}; |
diff --git a/tools/nissy_extra.h b/tools/nissy_extra.h index 505f53a..63d171b 100644 --- a/tools/nissy_extra.h +++ b/tools/nissy_extra.h | |||
| @@ -9,7 +9,6 @@ for testing purposes only. | |||
| 9 | #include "../src/solvers/tables_types_macros.h" | 9 | #include "../src/solvers/tables_types_macros.h" |
| 10 | #include "../src/solvers/tables.h" | 10 | #include "../src/solvers/tables.h" |
| 11 | 11 | ||
| 12 | size_t gendata_h48_derive(uint8_t, const void *, void *); | 12 | size_t gendata_h48_derive(uint8_t, const unsigned char *, unsigned char *); |
| 13 | int parse_h48_solver(const char *, uint8_t [static 1], uint8_t [static 1]); | 13 | int parse_h48_solver(const char *, uint8_t [static 1], uint8_t [static 1]); |
| 14 | long long int nissy_datainfo(uint64_t, const char *); | 14 | long long int nissy_datainfo(uint64_t, const unsigned char *); |
| 15 | long long int nissy_derivedata(const char *, const void *, void *); | ||
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); |
