diff options
Diffstat (limited to '')
40 files changed, 225 insertions, 6 deletions
diff --git a/src/solvers/coord/checkdata.h b/src/solvers/coord/checkdata.h index 51265a8..a5d5316 100644 --- a/src/solvers/coord/checkdata.h +++ b/src/solvers/coord/checkdata.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_CHECKDATA_H | ||
| 2 | #define SOLVERS_COORD_CHECKDATA_H | ||
| 3 | |||
| 1 | STATIC long long checkdata_coord_dispatch( | 4 | STATIC long long checkdata_coord_dispatch( |
| 2 | const char *, unsigned long long, const unsigned char *); | 5 | const char *, unsigned long long, const unsigned char *); |
| 3 | STATIC long long checkdata_coord( | 6 | STATIC long long checkdata_coord( |
| @@ -120,3 +123,5 @@ checkdata_multicoord( | |||
| 120 | 123 | ||
| 121 | return NISSY_OK; | 124 | return NISSY_OK; |
| 122 | } | 125 | } |
| 126 | |||
| 127 | #endif /* SOLVERS_COORD_CHECKDATA_H */ | ||
diff --git a/src/solvers/coord/common.h b/src/solvers/coord/common.h index 3a62e85..8e6db20 100644 --- a/src/solvers/coord/common.h +++ b/src/solvers/coord/common.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_COMMON_H | ||
| 2 | #define SOLVERS_COORD_COMMON_H | ||
| 3 | |||
| 1 | STATIC uint64_t coord_coord_generic( | 4 | STATIC uint64_t coord_coord_generic( |
| 2 | const coord_t [NON_NULL], cube_t, const unsigned char *); | 5 | const coord_t [NON_NULL], cube_t, const unsigned char *); |
| 3 | STATIC cube_t coord_cube_generic( | 6 | STATIC cube_t coord_cube_generic( |
| @@ -229,3 +232,5 @@ coordinate_merge_cpco(cube_t cp, cube_t co) | |||
| 229 | 232 | ||
| 230 | return merged; | 233 | return merged; |
| 231 | } | 234 | } |
| 235 | |||
| 236 | #endif /* SOLVERS_COORD_COMMON_H */ | ||
diff --git a/src/solvers/coord/coord.h b/src/solvers/coord/coord.h index 98f4d05..6c4cc1b 100644 --- a/src/solvers/coord/coord.h +++ b/src/solvers/coord/coord.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_COORD_H | ||
| 2 | #define SOLVERS_COORD_COORD_H | ||
| 3 | |||
| 1 | #include "types_macros.h" | 4 | #include "types_macros.h" |
| 2 | #include "common.h" | 5 | #include "common.h" |
| 3 | #include "eo.h" | 6 | #include "eo.h" |
| @@ -16,3 +19,5 @@ | |||
| 16 | #include "checkdata.h" | 19 | #include "checkdata.h" |
| 17 | #include "solve.h" | 20 | #include "solve.h" |
| 18 | #include "multisolve.h" | 21 | #include "multisolve.h" |
| 22 | |||
| 23 | #endif /* SOLVERS_COORD_COORD_H */ | ||
diff --git a/src/solvers/coord/corners.h b/src/solvers/coord/corners.h index cc0d9a5..6dd60b5 100644 --- a/src/solvers/coord/corners.h +++ b/src/solvers/coord/corners.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_CORNERS_H | ||
| 2 | #define SOLVERS_COORD_CORNERS_H | ||
| 3 | |||
| 1 | #define CLASSES_CP_48 984 | 4 | #define CLASSES_CP_48 984 |
| 2 | 5 | ||
| 3 | STATIC uint64_t coordinate_corners_coord(const cube_t, const unsigned char *); | 6 | STATIC uint64_t coordinate_corners_coord(const cube_t, const unsigned char *); |
| @@ -70,3 +73,5 @@ coordinate_corners_gendata(unsigned char *data) | |||
| 70 | { | 73 | { |
| 71 | return coord_gendata_generic(&coordinate_corners, data); | 74 | return coord_gendata_generic(&coordinate_corners, data); |
| 72 | } | 75 | } |
| 76 | |||
| 77 | #endif /* SOLVERS_COORD_CORNERS_H */ | ||
diff --git a/src/solvers/coord/cornersx.h b/src/solvers/coord/cornersx.h index 788db8d..f4b564f 100644 --- a/src/solvers/coord/cornersx.h +++ b/src/solvers/coord/cornersx.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_CORNERSX_H | ||
| 2 | #define SOLVERS_COORD_CORNERSX_H | ||
| 3 | |||
| 1 | STATIC bool is_cornersx_solved(uint64_t, const unsigned char *); | 4 | STATIC bool is_cornersx_solved(uint64_t, const unsigned char *); |
| 2 | 5 | ||
| 3 | STATIC coord_t coordinate_cornersx = { | 6 | STATIC coord_t coordinate_cornersx = { |
| @@ -74,3 +77,5 @@ is_cornersx_solved(uint64_t coord, const unsigned char *data) | |||
| 74 | 77 | ||
| 75 | return false; | 78 | return false; |
| 76 | } | 79 | } |
| 80 | |||
| 81 | #endif /* SOLVERS_COORD_CORNERSX_H */ | ||
diff --git a/src/solvers/coord/cpepe.h b/src/solvers/coord/cpepe.h index 7035400..1ad80dd 100644 --- a/src/solvers/coord/cpepe.h +++ b/src/solvers/coord/cpepe.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_CPEPE_H | ||
| 2 | #define SOLVERS_COORD_CPEPE_H | ||
| 3 | |||
| 1 | STATIC uint64_t coordinate_cpepe_coord(const cube_t, const unsigned char *); | 4 | STATIC uint64_t coordinate_cpepe_coord(const cube_t, const unsigned char *); |
| 2 | STATIC cube_t coordinate_cpepe_cube(uint64_t, const unsigned char *); | 5 | STATIC cube_t coordinate_cpepe_cube(uint64_t, const unsigned char *); |
| 3 | STATIC bool coordinate_cpepe_isnasty(uint64_t, const unsigned char *); | 6 | STATIC bool coordinate_cpepe_isnasty(uint64_t, const unsigned char *); |
| @@ -71,3 +74,5 @@ coordinate_cpepe_gendata(unsigned char *data) | |||
| 71 | { | 74 | { |
| 72 | return coord_gendata_generic(&coordinate_cpepe, data); | 75 | return coord_gendata_generic(&coordinate_cpepe, data); |
| 73 | } | 76 | } |
| 77 | |||
| 78 | #endif /* SOLVERS_COORD_CPEPE_H */ | ||
diff --git a/src/solvers/coord/dr.h b/src/solvers/coord/dr.h index 8100910..c5c73c2 100644 --- a/src/solvers/coord/dr.h +++ b/src/solvers/coord/dr.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_DR_H | ||
| 2 | #define SOLVERS_COORD_DR_H | ||
| 3 | |||
| 1 | #define DREOESEP_CLASSES UINT64_C(64430) | 4 | #define DREOESEP_CLASSES UINT64_C(64430) |
| 2 | #define DREOESEP_MAX (POW_2_11 * COMB_12_4) | 5 | #define DREOESEP_MAX (POW_2_11 * COMB_12_4) |
| 3 | 6 | ||
| @@ -117,3 +120,5 @@ is_eoco_solvable(cube_t cube) { | |||
| 117 | 120 | ||
| 118 | return cocount % 3 == 0 && eocount % 2 == 0; | 121 | return cocount % 3 == 0 && eocount % 2 == 0; |
| 119 | } | 122 | } |
| 123 | |||
| 124 | #endif /* SOLVERS_COORD_DR_H */ | ||
diff --git a/src/solvers/coord/dreo.h b/src/solvers/coord/dreo.h index c5cacac..a201ae6 100644 --- a/src/solvers/coord/dreo.h +++ b/src/solvers/coord/dreo.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_DREO_H | ||
| 2 | #define SOLVERS_COORD_DREO_H | ||
| 3 | |||
| 1 | #define DRESEP_CLASSES 81 | 4 | #define DRESEP_CLASSES 81 |
| 2 | 5 | ||
| 3 | STATIC uint64_t coord_dresep_nosym(cube_t); | 6 | STATIC uint64_t coord_dresep_nosym(cube_t); |
| @@ -101,3 +104,5 @@ is_dreo_solvable(cube_t cube) { | |||
| 101 | 104 | ||
| 102 | return cocount % 3 == 0; | 105 | return cocount % 3 == 0; |
| 103 | } | 106 | } |
| 107 | |||
| 108 | #endif /* SOLVERS_COORD_DREO_H */ | ||
diff --git a/src/solvers/coord/drfin.h b/src/solvers/coord/drfin.h index 569419b..ec645a2 100644 --- a/src/solvers/coord/drfin.h +++ b/src/solvers/coord/drfin.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_DRFIN_H | ||
| 2 | #define SOLVERS_COORD_DRFIN_H | ||
| 3 | |||
| 1 | STATIC bool is_drfin_solvable(cube_t); | 4 | STATIC bool is_drfin_solvable(cube_t); |
| 2 | 5 | ||
| 3 | STATIC multicoord_t multicoordinate_drfin = { | 6 | STATIC multicoord_t multicoordinate_drfin = { |
| @@ -15,3 +18,5 @@ is_drfin_solvable(cube_t cube) | |||
| 15 | coord_co(cube) == 0 && | 18 | coord_co(cube) == 0 && |
| 16 | issolvable((oriented_cube_t){.cube = cube, .orientation = 0}); | 19 | issolvable((oriented_cube_t){.cube = cube, .orientation = 0}); |
| 17 | } | 20 | } |
| 21 | |||
| 22 | #endif /* SOLVERS_COORD_DRFIN_H */ | ||
diff --git a/src/solvers/coord/drfinnoe.h b/src/solvers/coord/drfinnoe.h index 63f4edf..5ffffc3 100644 --- a/src/solvers/coord/drfinnoe.h +++ b/src/solvers/coord/drfinnoe.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_DRFINNOE_H | ||
| 2 | #define SOLVERS_COORD_DRFINNOE_H | ||
| 3 | |||
| 1 | /* | 4 | /* |
| 2 | TODO | 5 | TODO |
| 3 | 6 | ||
| @@ -96,3 +99,5 @@ is_drfinnoe_solvable(cube_t cube) { | |||
| 96 | coord_eo(transform_edges(cube, TRANS_URr)) == 0 && | 99 | coord_eo(transform_edges(cube, TRANS_URr)) == 0 && |
| 97 | coord_co(cube) == 0; | 100 | coord_co(cube) == 0; |
| 98 | } | 101 | } |
| 102 | |||
| 103 | #endif /* SOLVERS_COORD_DRFINNOE_H */ | ||
diff --git a/src/solvers/coord/drslice.h b/src/solvers/coord/drslice.h index 42699f8..87bf87e 100644 --- a/src/solvers/coord/drslice.h +++ b/src/solvers/coord/drslice.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_DRSLICE_H | ||
| 2 | #define SOLVERS_COORD_DRSLICE_H | ||
| 3 | |||
| 1 | /* | 4 | /* |
| 2 | The DRSLICE coordinate is almost identical to DRFINNOE, but it allows for | 5 | The DRSLICE coordinate is almost identical to DRFINNOE, but it allows for |
| 3 | the centers of the E layer to be off by a rotation. For this reason we reuse | 6 | the centers of the E layer to be off by a rotation. For this reason we reuse |
| @@ -95,3 +98,5 @@ is_drslice_solved(uint64_t i, const unsigned char *data) | |||
| 95 | /* Pre-computed coordinates of U D' (= U' D up to trans) and U2 D2 */ | 98 | /* Pre-computed coordinates of U D' (= U' D up to trans) and U2 D2 */ |
| 96 | return i == 0 || i == 109779816 || i == 68468527; | 99 | return i == 0 || i == 109779816 || i == 68468527; |
| 97 | } | 100 | } |
| 101 | |||
| 102 | #endif /* SOLVERS_COORD_DRSLICE_H */ | ||
diff --git a/src/solvers/coord/eo.h b/src/solvers/coord/eo.h index 42196af..a5a0e85 100644 --- a/src/solvers/coord/eo.h +++ b/src/solvers/coord/eo.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_EO_H | ||
| 2 | #define SOLVERS_COORD_EO_H | ||
| 3 | |||
| 1 | STATIC uint64_t coordinate_eo_coord(cube_t, const unsigned char *); | 4 | STATIC uint64_t coordinate_eo_coord(cube_t, const unsigned char *); |
| 2 | STATIC cube_t coordinate_eo_cube(uint64_t, const unsigned char *); | 5 | STATIC cube_t coordinate_eo_cube(uint64_t, const unsigned char *); |
| 3 | STATIC bool coordinate_eo_isnasty(uint64_t, const unsigned char *); | 6 | STATIC bool coordinate_eo_isnasty(uint64_t, const unsigned char *); |
| @@ -57,3 +60,5 @@ coordinate_eo_gendata(unsigned char *data) | |||
| 57 | { | 60 | { |
| 58 | return 0; | 61 | return 0; |
| 59 | } | 62 | } |
| 63 | |||
| 64 | #endif /* SOLVERS_COORD_EO_H */ | ||
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index 81ab842..a48263c 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_GENDATA_H | ||
| 2 | #define SOLVERS_COORD_GENDATA_H | ||
| 3 | |||
| 1 | STATIC size_t gendata_coord(const coord_t [NON_NULL], unsigned char *); | 4 | STATIC size_t gendata_coord(const coord_t [NON_NULL], unsigned char *); |
| 2 | STATIC size_t gendata_multicoord( | 5 | STATIC size_t gendata_multicoord( |
| 3 | const multicoord_t [NON_NULL], unsigned char *); | 6 | const multicoord_t [NON_NULL], unsigned char *); |
| @@ -362,3 +365,5 @@ set_coord_pval( | |||
| 362 | table[COORD_INDEX(i)] = (table[COORD_INDEX(i)] & (~COORD_MASK(i))) | 365 | table[COORD_INDEX(i)] = (table[COORD_INDEX(i)] & (~COORD_MASK(i))) |
| 363 | | (val << COORD_SHIFT(i)); | 366 | | (val << COORD_SHIFT(i)); |
| 364 | } | 367 | } |
| 368 | |||
| 369 | #endif /* SOLVERS_COORD_GENDATA_H */ | ||
diff --git a/src/solvers/coord/htr.h b/src/solvers/coord/htr.h index 602625b..d6fc311 100644 --- a/src/solvers/coord/htr.h +++ b/src/solvers/coord/htr.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_HTR_H | ||
| 2 | #define SOLVERS_COORD_HTR_H | ||
| 3 | |||
| 1 | STATIC uint64_t coordinate_htr_coord(cube_t, const unsigned char *); | 4 | STATIC uint64_t coordinate_htr_coord(cube_t, const unsigned char *); |
| 2 | STATIC cube_t coordinate_htr_cube(uint64_t, const unsigned char *); | 5 | STATIC cube_t coordinate_htr_cube(uint64_t, const unsigned char *); |
| 3 | STATIC bool coordinate_htr_isnasty(uint64_t, const unsigned char *); | 6 | STATIC bool coordinate_htr_isnasty(uint64_t, const unsigned char *); |
| @@ -123,3 +126,5 @@ is_cp_htr(uint64_t i, const unsigned char *data) | |||
| 123 | 126 | ||
| 124 | return e == 0 && is_cp16_htr_table[c / 8] & (UINT8_C(1) << (c % 8)); | 127 | return e == 0 && is_cp16_htr_table[c / 8] & (UINT8_C(1) << (c % 8)); |
| 125 | } | 128 | } |
| 129 | |||
| 130 | #endif /* SOLVERS_COORD_HTR_H */ | ||
diff --git a/src/solvers/coord/list.h b/src/solvers/coord/list.h index 6856c13..71f7920 100644 --- a/src/solvers/coord/list.h +++ b/src/solvers/coord/list.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_LIST_H | ||
| 2 | #define SOLVERS_COORD_LIST_H | ||
| 3 | |||
| 1 | coord_t *all_coordinates[] = { | 4 | coord_t *all_coordinates[] = { |
| 2 | &coordinate_eo, | 5 | &coordinate_eo, |
| 3 | &coordinate_dr, | 6 | &coordinate_dr, |
| @@ -15,3 +18,5 @@ multicoord_t *all_multicoordinates[] = { | |||
| 15 | &multicoordinate_drfin, | 18 | &multicoordinate_drfin, |
| 16 | NULL | 19 | NULL |
| 17 | }; | 20 | }; |
| 21 | |||
| 22 | #endif /* SOLVERS_COORD_LIST_H */ | ||
diff --git a/src/solvers/coord/multisolve.h b/src/solvers/coord/multisolve.h index efd287d..4990a39 100644 --- a/src/solvers/coord/multisolve.h +++ b/src/solvers/coord/multisolve.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_MULTISOLVE_H | ||
| 2 | #define SOLVERS_COORD_MULTISOLVE_H | ||
| 3 | |||
| 1 | /* | 4 | /* |
| 2 | For now the only multicoordinate is DRFIN, and this solver reflects this. | 5 | For now the only multicoordinate is DRFIN, and this solver reflects this. |
| 3 | For example, NISS is not available. | 6 | For example, NISS is not available. |
| @@ -297,3 +300,5 @@ solve_multicoord_error_unsolvable: | |||
| 297 | LOG("[%s solve] Error: cube not ready\n", mcoord->name); | 300 | LOG("[%s solve] Error: cube not ready\n", mcoord->name); |
| 298 | return NISSY_ERROR_UNSOLVABLE_CUBE; | 301 | return NISSY_ERROR_UNSOLVABLE_CUBE; |
| 299 | } | 302 | } |
| 303 | |||
| 304 | #endif /* SOLVERS_COORD_MULTISOLVE_H */ | ||
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index 6bb9af2..9a0c63c 100644 --- a/src/solvers/coord/solve.h +++ b/src/solvers/coord/solve.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_SOLVE_H | ||
| 2 | #define SOLVERS_COORD_SOLVE_H | ||
| 3 | |||
| 1 | typedef struct { | 4 | typedef struct { |
| 2 | cube_t cube; | 5 | cube_t cube; |
| 3 | cube_t inverse; | 6 | cube_t inverse; |
| @@ -400,3 +403,5 @@ solve_coord_error_unsolvable: | |||
| 400 | LOG("[%s solve] Error: cube not ready\n", coord->name); | 403 | LOG("[%s solve] Error: cube not ready\n", coord->name); |
| 401 | return NISSY_ERROR_UNSOLVABLE_CUBE; | 404 | return NISSY_ERROR_UNSOLVABLE_CUBE; |
| 402 | } | 405 | } |
| 406 | |||
| 407 | #endif /* SOLVERS_COORD_SOLVE_H */ | ||
diff --git a/src/solvers/coord/types_macros.h b/src/solvers/coord/types_macros.h index 81db9d4..b042788 100644 --- a/src/solvers/coord/types_macros.h +++ b/src/solvers/coord/types_macros.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_TYPES_MACROS_H | ||
| 2 | #define SOLVERS_COORD_TYPES_MACROS_H | ||
| 3 | |||
| 1 | #define COORD_INDEX(i) ((i)/2) | 4 | #define COORD_INDEX(i) ((i)/2) |
| 2 | #define COORD_SHIFT(i) (UINT8_C(4) * (uint8_t)((i) % 2)) | 5 | #define COORD_SHIFT(i) (UINT8_C(4) * (uint8_t)((i) % 2)) |
| 3 | #define COORD_MASK(i) (UINT8_C(0xF) << COORD_SHIFT(i)) | 6 | #define COORD_MASK(i) (UINT8_C(0xF) << COORD_SHIFT(i)) |
| @@ -53,3 +56,5 @@ typedef struct { | |||
| 53 | uint64_t moves_mask; | 56 | uint64_t moves_mask; |
| 54 | bool (*is_solvable)(cube_t); | 57 | bool (*is_solvable)(cube_t); |
| 55 | } multicoord_t; | 58 | } multicoord_t; |
| 59 | |||
| 60 | #endif /* SOLVERS_COORD_TYPES_MACROS_H */ | ||
diff --git a/src/solvers/coord/utils.h b/src/solvers/coord/utils.h index 0062587..232d6f8 100644 --- a/src/solvers/coord/utils.h +++ b/src/solvers/coord/utils.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_COORD_UTILS_H | ||
| 2 | #define SOLVERS_COORD_UTILS_H | ||
| 3 | |||
| 1 | STATIC coord_t *parse_coord(size_t, const char *); | 4 | STATIC coord_t *parse_coord(size_t, const char *); |
| 2 | STATIC multicoord_t *parse_multicoord(size_t, const char *); | 5 | STATIC multicoord_t *parse_multicoord(size_t, const char *); |
| 3 | STATIC void parse_coord_and_trans( | 6 | STATIC void parse_coord_and_trans( |
| @@ -80,3 +83,5 @@ dataid_coord(const char *ca, char dataid[SIZE(NISSY_SIZE_DATAID)]) | |||
| 80 | LOG("Error: cannot parse coordinate from '%s'\n", ca); | 83 | LOG("Error: cannot parse coordinate from '%s'\n", ca); |
| 81 | return NISSY_ERROR_INVALID_SOLVER; | 84 | return NISSY_ERROR_INVALID_SOLVER; |
| 82 | } | 85 | } |
| 86 | |||
| 87 | #endif /* SOLVERS_COORD_UTILS_H */ | ||
diff --git a/src/solvers/dispatch.h b/src/solvers/dispatch.h index f6d2bee..89a0771 100644 --- a/src/solvers/dispatch.h +++ b/src/solvers/dispatch.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_DISPATCH_H | ||
| 2 | #define SOLVERS_DISPATCH_H | ||
| 3 | |||
| 1 | typedef struct { | 4 | typedef struct { |
| 2 | const char *solvername; | 5 | const char *solvername; |
| 3 | const char *prefix; | 6 | const char *prefix; |
| @@ -100,3 +103,5 @@ match_solver(const char *name) | |||
| 100 | 103 | ||
| 101 | return solver_dispatchers[i]; | 104 | return solver_dispatchers[i]; |
| 102 | } | 105 | } |
| 106 | |||
| 107 | #endif /* SOLVERS_DISPATCH_H */ | ||
diff --git a/src/solvers/distribution.h b/src/solvers/distribution.h index a996e3db..1ed7453 100644 --- a/src/solvers/distribution.h +++ b/src/solvers/distribution.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_DISTRIBUTION_H | ||
| 2 | #define SOLVERS_DISTRIBUTION_H | ||
| 3 | |||
| 1 | #define ENTRIES_PER_BYTE(k) (UINT64_C(8) / (uint64_t)(k)) | 4 | #define ENTRIES_PER_BYTE(k) (UINT64_C(8) / (uint64_t)(k)) |
| 2 | #define TABLE_SHIFT(i, k) ((uint8_t)(k) * (uint8_t)((i) % ENTRIES_PER_BYTE(k))) | 5 | #define TABLE_SHIFT(i, k) ((uint8_t)(k) * (uint8_t)((i) % ENTRIES_PER_BYTE(k))) |
| 3 | #define TABLE_MASK(i, k) ((UINT8_BIT(k) - UINT8_C(1)) << TABLE_SHIFT(i, k)) | 6 | #define TABLE_MASK(i, k) ((UINT8_BIT(k) - UINT8_C(1)) << TABLE_SHIFT(i, k)) |
| @@ -99,3 +102,5 @@ distribution_equal( | |||
| 99 | 102 | ||
| 100 | return wrong == 0; | 103 | return wrong == 0; |
| 101 | } | 104 | } |
| 105 | |||
| 106 | #endif /* SOLVERS_DISTRIBUTION_H */ | ||
diff --git a/src/solvers/h48/checkdata.h b/src/solvers/h48/checkdata.h index 948ac67..e2fa38c 100644 --- a/src/solvers/h48/checkdata.h +++ b/src/solvers/h48/checkdata.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_CHECKDATA_H | ||
| 2 | #define SOLVERS_H48_CHECKDATA_H | ||
| 3 | |||
| 1 | STATIC long long checkdata_h48( | 4 | STATIC long long checkdata_h48( |
| 2 | const char *, unsigned long long, const unsigned char *); | 5 | const char *, unsigned long long, const unsigned char *); |
| 3 | 6 | ||
| @@ -194,3 +197,5 @@ checkdata_h48( | |||
| 194 | 197 | ||
| 195 | return NISSY_OK; | 198 | return NISSY_OK; |
| 196 | } | 199 | } |
| 200 | |||
| 201 | #endif /* SOLVERS_H48_CHECKDATA_H */ | ||
diff --git a/src/solvers/h48/coordinate.h b/src/solvers/h48/coordinate.h index 695efc3..acbb9c0 100644 --- a/src/solvers/h48/coordinate.h +++ b/src/solvers/h48/coordinate.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_COORDINATE_H | ||
| 2 | #define SOLVERS_H48_COORDINATE_H | ||
| 3 | |||
| 1 | STATIC_INLINE uint64_t coord_h48( | 4 | STATIC_INLINE uint64_t coord_h48( |
| 2 | cube_t, const uint32_t [SIZE(COCSEP_TABLESIZE)], uint8_t); | 5 | cube_t, const uint32_t [SIZE(COCSEP_TABLESIZE)], uint8_t); |
| 3 | STATIC_INLINE uint64_t coord_h48_edges(cube_t, uint64_t, uint8_t, uint8_t); | 6 | STATIC_INLINE uint64_t coord_h48_edges(cube_t, uint64_t, uint8_t, uint8_t); |
| @@ -68,3 +71,5 @@ invcoord_h48( | |||
| 68 | 71 | ||
| 69 | return ret; | 72 | return ret; |
| 70 | } | 73 | } |
| 74 | |||
| 75 | #endif /* SOLVERS_H48_COORDINATE_H */ | ||
diff --git a/src/solvers/h48/coordinate_types_macros.h b/src/solvers/h48/coordinate_types_macros.h index cf24e47..6ddd3e8 100644 --- a/src/solvers/h48/coordinate_types_macros.h +++ b/src/solvers/h48/coordinate_types_macros.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_COORDINATE_TYPES_MACROS_H | ||
| 2 | #define SOLVERS_H48_COORDINATE_TYPES_MACROS_H | ||
| 3 | |||
| 1 | #define H48_ESIZE(h) ((COMB_12_4 * COMB_8_4) << (uint64_t)(h)) | 4 | #define H48_ESIZE(h) ((COMB_12_4 * COMB_8_4) << (uint64_t)(h)) |
| 2 | 5 | ||
| 3 | #define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16)) | 6 | #define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16)) |
| @@ -5,3 +8,5 @@ | |||
| 5 | #define ECLASS(x) COCLASS(x) | 8 | #define ECLASS(x) COCLASS(x) |
| 6 | #define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8)) | 9 | #define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8)) |
| 7 | #define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8)) | 10 | #define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8)) |
| 11 | |||
| 12 | #endif /* SOLVERS_H48_COORDINATE_TYPES_MACROS_H */ | ||
diff --git a/src/solvers/h48/distribution_h48.h b/src/solvers/h48/distribution_h48.h index 2cb50aa..b7f3811 100644 --- a/src/solvers/h48/distribution_h48.h +++ b/src/solvers/h48/distribution_h48.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_DISTRIBUTION_H48_H | ||
| 2 | #define SOLVERS_H48_DISTRIBUTION_H48_H | ||
| 3 | |||
| 1 | /* | 4 | /* |
| 2 | This file is very similar to ../distibution.h, but some adaptations are | 5 | This file is very similar to ../distibution.h, but some adaptations are |
| 3 | needed for H48 because of the intertwined fallback table, and it is easier | 6 | needed for H48 because of the intertwined fallback table, and it is easier |
| @@ -74,3 +77,5 @@ getdistribution_h48( | |||
| 74 | c = H48_LINE_EXT(H48_COORDMAX(info->h48h)) % H48_LINE_ALLCOORDS; | 77 | c = H48_LINE_EXT(H48_COORDMAX(info->h48h)) % H48_LINE_ALLCOORDS; |
| 75 | distr[3] -= H48_LINE_COORDS - c; | 78 | distr[3] -= H48_LINE_COORDS - c; |
| 76 | } | 79 | } |
| 80 | |||
| 81 | #endif /* SOLVERS_H48_DISTRIBUTION_H48_H */ | ||
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index f83207b..1cea52e 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_GENDATA_COCSEP_H | ||
| 2 | #define SOLVERS_H48_GENDATA_COCSEP_H | ||
| 3 | |||
| 1 | STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); | 4 | STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 2 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [NON_NULL]); | 5 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [NON_NULL]); |
| 3 | 6 | ||
| @@ -164,3 +167,5 @@ get_h48_cdata( | |||
| 164 | 167 | ||
| 165 | return CBOUND(*cdata); | 168 | return CBOUND(*cdata); |
| 166 | } | 169 | } |
| 170 | |||
| 171 | #endif /* SOLVERS_H48_GENDATA_COCSEP_H */ | ||
diff --git a/src/solvers/h48/gendata_eoesep.h b/src/solvers/h48/gendata_eoesep.h index 81bbd43..55097c9 100644 --- a/src/solvers/h48/gendata_eoesep.h +++ b/src/solvers/h48/gendata_eoesep.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_GENDATA_EOESEP_H | ||
| 2 | #define SOLVERS_H48_GENDATA_EOESEP_H | ||
| 3 | |||
| 1 | STATIC uint64_t coord_eoesep_sym(cube_t, const uint32_t [SIZE(ESEP_MAX)]); | 4 | STATIC uint64_t coord_eoesep_sym(cube_t, const uint32_t [SIZE(ESEP_MAX)]); |
| 2 | STATIC size_t gendata_esep_classes( | 5 | STATIC size_t gendata_esep_classes( |
| 3 | uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]); | 6 | uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]); |
| @@ -280,3 +283,5 @@ set_eoesep_pval( | |||
| 280 | table[EOESEP_INDEX(i)] = (table[EOESEP_INDEX(i)] & (~EOESEP_MASK(i))) | 283 | table[EOESEP_INDEX(i)] = (table[EOESEP_INDEX(i)] & (~EOESEP_MASK(i))) |
| 281 | | (val << EOESEP_SHIFT(i)); | 284 | | (val << EOESEP_SHIFT(i)); |
| 282 | } | 285 | } |
| 286 | |||
| 287 | #endif /* SOLVERS_H48_GENDATA_EOESEP_H */ | ||
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index 53b1fad..0b85e49 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_GENDATA_H48_H | ||
| 2 | #define SOLVERS_H48_GENDATA_H48_H | ||
| 3 | |||
| 1 | STATIC long long gendata_h48_dispatch( | 4 | STATIC long long gendata_h48_dispatch( |
| 2 | const char *, unsigned long long, unsigned char *); | 5 | const char *, unsigned long long, unsigned char *); |
| 3 | STATIC uint64_t gendata_h48short(gendata_h48short_arg_t [NON_NULL]); | 6 | STATIC uint64_t gendata_h48short(gendata_h48short_arg_t [NON_NULL]); |
| @@ -547,3 +550,5 @@ get_h48_pval_and_min( | |||
| 547 | *pval_min = tmin >> UINT8_C(4); | 550 | *pval_min = tmin >> UINT8_C(4); |
| 548 | return (t & H48_MASK(iext)) >> H48_SHIFT(iext); | 551 | return (t & H48_MASK(iext)) >> H48_SHIFT(iext); |
| 549 | } | 552 | } |
| 553 | |||
| 554 | #endif /* SOLVERS_H48_GENDATA_H48_H */ | ||
diff --git a/src/solvers/h48/gendata_types_macros.h b/src/solvers/h48/gendata_types_macros.h index 9bce2c9..e81acc5 100644 --- a/src/solvers/h48/gendata_types_macros.h +++ b/src/solvers/h48/gendata_types_macros.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_GENDATA_TYPES_MACROS_H | ||
| 2 | #define SOLVERS_H48_GENDATA_TYPES_MACROS_H | ||
| 3 | |||
| 1 | #define COCSEP_CLASSES ((size_t)3393) | 4 | #define COCSEP_CLASSES ((size_t)3393) |
| 2 | #define COCSEP_TABLESIZE ((size_t)POW_3_7 << (size_t)7) | 5 | #define COCSEP_TABLESIZE ((size_t)POW_3_7 << (size_t)7) |
| 3 | #define COCSEP_VISITEDSIZE DIV_ROUND_UP(COCSEP_TABLESIZE, (size_t)8) | 6 | #define COCSEP_VISITEDSIZE DIV_ROUND_UP(COCSEP_TABLESIZE, (size_t)8) |
| @@ -116,3 +119,5 @@ typedef struct { | |||
| 116 | wrapthread_atomic unsigned char *table_atomic; | 119 | wrapthread_atomic unsigned char *table_atomic; |
| 117 | wrapthread_define_struct_mutex_t(**table_mutex); | 120 | wrapthread_define_struct_mutex_t(**table_mutex); |
| 118 | } gendata_h48_mark_t; | 121 | } gendata_h48_mark_t; |
| 122 | |||
| 123 | #endif /* SOLVERS_H48_GENDATA_TYPES_MACROS_H */ | ||
diff --git a/src/solvers/h48/h48.h b/src/solvers/h48/h48.h index f7ba8b7..e05fc2b 100644 --- a/src/solvers/h48/h48.h +++ b/src/solvers/h48/h48.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_H48_H | ||
| 2 | #define SOLVERS_H48_H48_H | ||
| 3 | |||
| 1 | #include "utils.h" | 4 | #include "utils.h" |
| 2 | #include "coordinate_types_macros.h" | 5 | #include "coordinate_types_macros.h" |
| 3 | #include "map_types_macros.h" | 6 | #include "map_types_macros.h" |
| @@ -10,3 +13,5 @@ | |||
| 10 | #include "gendata_h48.h" | 13 | #include "gendata_h48.h" |
| 11 | #include "checkdata.h" | 14 | #include "checkdata.h" |
| 12 | #include "solve.h" | 15 | #include "solve.h" |
| 16 | |||
| 17 | #endif /* SOLVERS_H48_H48_H */ | ||
diff --git a/src/solvers/h48/map.h b/src/solvers/h48/map.h index c9cfb06..75b5236 100644 --- a/src/solvers/h48/map.h +++ b/src/solvers/h48/map.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_MAP_H | ||
| 2 | #define SOLVERS_H48_MAP_H | ||
| 3 | |||
| 1 | STATIC void h48map_create(h48map_t [NON_NULL], uint64_t, uint64_t); | 4 | STATIC void h48map_create(h48map_t [NON_NULL], uint64_t, uint64_t); |
| 2 | STATIC void h48map_clear(h48map_t [NON_NULL]); | 5 | STATIC void h48map_clear(h48map_t [NON_NULL]); |
| 3 | STATIC void h48map_destroy(h48map_t [NON_NULL]); | 6 | STATIC void h48map_destroy(h48map_t [NON_NULL]); |
| @@ -82,3 +85,5 @@ h48map_nextkvpair(h48map_t map[NON_NULL], uint64_t p[NON_NULL]) | |||
| 82 | 85 | ||
| 83 | return kv; | 86 | return kv; |
| 84 | } | 87 | } |
| 88 | |||
| 89 | #endif /* SOLVERS_H48_MAP_H */ | ||
diff --git a/src/solvers/h48/map_types_macros.h b/src/solvers/h48/map_types_macros.h index b77c68a..a4e3c75 100644 --- a/src/solvers/h48/map_types_macros.h +++ b/src/solvers/h48/map_types_macros.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_MAP_TYPES_MACROS_H | ||
| 2 | #define SOLVERS_H48_MAP_TYPES_MACROS_H | ||
| 3 | |||
| 1 | #define MAP_UNSET UINT64_C(0xFFFFFFFFFFFFFFFF) | 4 | #define MAP_UNSET UINT64_C(0xFFFFFFFFFFFFFFFF) |
| 2 | #define MAP_KEYMASK UINT64_C(0xFFFFFFFFFF) | 5 | #define MAP_KEYMASK UINT64_C(0xFFFFFFFFFF) |
| 3 | #define MAP_KEYSHIFT UINT64_C(40) | 6 | #define MAP_KEYSHIFT UINT64_C(40) |
| @@ -14,3 +17,5 @@ typedef struct { | |||
| 14 | uint64_t key; | 17 | uint64_t key; |
| 15 | uint64_t val; | 18 | uint64_t val; |
| 16 | } kvpair_t; | 19 | } kvpair_t; |
| 20 | |||
| 21 | #endif /* SOLVERS_H48_MAP_TYPES_MACROS_H */ | ||
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index ebc5208..36fefa1 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_SOLVE_H | ||
| 2 | #define SOLVERS_H48_SOLVE_H | ||
| 3 | |||
| 1 | #define H48_STARTING_MOVES 4 | 4 | #define H48_STARTING_MOVES 4 |
| 2 | #define H48_STARTING_CUBES 43254 | 5 | #define H48_STARTING_CUBES 43254 |
| 3 | #define H48_SORT_TASKS_MIN_DEPTH 16 | 6 | #define H48_SORT_TASKS_MIN_DEPTH 16 |
| @@ -758,3 +761,5 @@ solve_h48_error_data: | |||
| 758 | solve_h48_error_solutions_buffer: | 761 | solve_h48_error_solutions_buffer: |
| 759 | return NISSY_ERROR_BUFFER_SIZE; | 762 | return NISSY_ERROR_BUFFER_SIZE; |
| 760 | } | 763 | } |
| 764 | |||
| 765 | #endif /* SOLVERS_H48_SOLVE_H */ | ||
diff --git a/src/solvers/h48/utils.h b/src/solvers/h48/utils.h index 6d91108..81c6451 100644 --- a/src/solvers/h48/utils.h +++ b/src/solvers/h48/utils.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_H48_UTILS_H | ||
| 2 | #define SOLVERS_H48_UTILS_H | ||
| 3 | |||
| 1 | #if SIZE_MAX == UINT64_MAX | 4 | #if SIZE_MAX == UINT64_MAX |
| 2 | #define H48_HMAX UINT8_C(11) | 5 | #define H48_HMAX UINT8_C(11) |
| 3 | #else | 6 | #else |
| @@ -63,3 +66,5 @@ dataid_h48(const char *str, char buf[SIZE(NISSY_SIZE_DATAID)]) | |||
| 63 | sprintf(buf, "h48h%" PRIu8, h); | 66 | sprintf(buf, "h48h%" PRIu8, h); |
| 64 | return NISSY_OK; | 67 | return NISSY_OK; |
| 65 | } | 68 | } |
| 69 | |||
| 70 | #endif /* SOLVERS_H48_UTILS_H */ | ||
diff --git a/src/solvers/solutions.h b/src/solvers/solutions.h index b7a848b..f9bed75 100644 --- a/src/solvers/solutions.h +++ b/src/solvers/solutions.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_SOLUTIONS_H | ||
| 2 | #define SOLVERS_SOLUTIONS_H | ||
| 3 | |||
| 1 | STATIC void solution_moves_reset(solution_moves_t [NON_NULL]); | 4 | STATIC void solution_moves_reset(solution_moves_t [NON_NULL]); |
| 2 | STATIC void solution_moves_transform(solution_moves_t [NON_NULL], size_t, | 5 | STATIC void solution_moves_transform(solution_moves_t [NON_NULL], size_t, |
| 3 | uint8_t); | 6 | uint8_t); |
| @@ -338,3 +341,5 @@ solutions_done( | |||
| 338 | depth > list->shortest_sol + settings->optimal || | 341 | depth > list->shortest_sol + settings->optimal || |
| 339 | list->nsols >= settings->maxsolutions; | 342 | list->nsols >= settings->maxsolutions; |
| 340 | } | 343 | } |
| 344 | |||
| 345 | #endif /* SOLVERS_SOLUTIONS_H */ | ||
diff --git a/src/solvers/solutions_types_macros.h b/src/solvers/solutions_types_macros.h index cecd140..6cde681 100644 --- a/src/solvers/solutions_types_macros.h +++ b/src/solvers/solutions_types_macros.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_SOLUTIONS_TYPES_MACROS_H | ||
| 2 | #define SOLVERS_SOLUTIONS_TYPES_MACROS_H | ||
| 3 | |||
| 1 | #define SOLUTION_MAXLEN 25 | 4 | #define SOLUTION_MAXLEN 25 |
| 2 | 5 | ||
| 3 | typedef struct { | 6 | typedef struct { |
| @@ -22,3 +25,5 @@ typedef struct { | |||
| 22 | size_t used; | 25 | size_t used; |
| 23 | char *buf; | 26 | char *buf; |
| 24 | } solution_list_t; | 27 | } solution_list_t; |
| 28 | |||
| 29 | #endif /* SOLVERS_SOLUTIONS_TYPES_MACROS_H */ | ||
diff --git a/src/solvers/solvers.h b/src/solvers/solvers.h index f9f2287..fab6e27 100644 --- a/src/solvers/solvers.h +++ b/src/solvers/solvers.h | |||
| @@ -1,9 +1,14 @@ | |||
| 1 | #ifndef SOLVERS_SOLVERS_H | ||
| 2 | #define SOLVERS_SOLVERS_H | ||
| 3 | |||
| 1 | #include "solutions_types_macros.h" | 4 | #include "solutions_types_macros.h" |
| 2 | #include "solutions.h" | 5 | #include "solutions.h" |
| 3 | #include "tables_types_macros.h" | 6 | #include "tables_types_macros.h" |
| 4 | #include "tables.h" | 7 | #include "tables.h" |
| 5 | #include "distribution.h" | 8 | #include "distribution.h" |
| 6 | /*#include "coord/coord.h"*/ | 9 | #include "coord/coord.h" |
| 7 | #include "twostep/twostep.h" | 10 | #include "twostep/twostep.h" |
| 8 | #include "h48/h48.h" | 11 | #include "h48/h48.h" |
| 9 | #include "dispatch.h" | 12 | #include "dispatch.h" |
| 13 | |||
| 14 | #endif /* SOLVERS_SOLVERS_H */ | ||
diff --git a/src/solvers/tables.h b/src/solvers/tables.h index 3db1d1e..f850793 100644 --- a/src/solvers/tables.h +++ b/src/solvers/tables.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_TABLES_H | ||
| 2 | #define SOLVERS_TABLES_H | ||
| 3 | |||
| 1 | STATIC uint64_t read_unaligned_u64( | 4 | STATIC uint64_t read_unaligned_u64( |
| 2 | const unsigned char [SIZE(sizeof(uint64_t))]); | 5 | const unsigned char [SIZE(sizeof(uint64_t))]); |
| 3 | STATIC void write_unaligned_u64( | 6 | STATIC void write_unaligned_u64( |
| @@ -147,3 +150,5 @@ append_name(tableinfo_t info[NON_NULL], const char *str) | |||
| 147 | 150 | ||
| 148 | info->solver[j] = '\0'; | 151 | info->solver[j] = '\0'; |
| 149 | } | 152 | } |
| 153 | |||
| 154 | #endif /* SOLVERS_TABLES_H */ | ||
diff --git a/src/solvers/tables_types_macros.h b/src/solvers/tables_types_macros.h index b2809b7..8ae18d3 100644 --- a/src/solvers/tables_types_macros.h +++ b/src/solvers/tables_types_macros.h | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | #ifndef SOLVERS_TABLES_TYPES_MACROS_H | ||
| 2 | #define SOLVERS_TABLES_TYPES_MACROS_H | ||
| 3 | |||
| 1 | #define OFFSET(B, K) (((unsigned char *)B) + K) | 4 | #define OFFSET(B, K) (((unsigned char *)B) + K) |
| 2 | 5 | ||
| 3 | #define INFOSIZE INT64_C(512) | 6 | #define INFOSIZE INT64_C(512) |
| @@ -37,3 +40,5 @@ typedef struct { | |||
| 37 | uint8_t base; | 40 | uint8_t base; |
| 38 | uint8_t maxvalue; | 41 | uint8_t maxvalue; |
| 39 | } tableinfo_t; | 42 | } tableinfo_t; |
| 43 | |||
| 44 | #endif /* SOLVERS_TABLES_TYPES_MACROS_H */ | ||
diff --git a/src/solvers/twostep/twostep.h b/src/solvers/twostep/twostep.h index 8947a50..e5b00f6 100644 --- a/src/solvers/twostep/twostep.h +++ b/src/solvers/twostep/twostep.h | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | #ifndef SRC_SOLVERS_TWOSTEP_TWOSTEP_H | ||
| 2 | #define SRC_SOLVERS_TWOSTEP_TWOSTEP_H | ||
| 3 | |||
| 1 | #include "../coord/coord.h" | 4 | #include "../coord/coord.h" |
| 2 | 5 | ||
| 6 | STATIC size_t twostep_size_1(void); | ||
| 7 | STATIC size_t twostep_size_2(void); | ||
| 3 | STATIC long long dataid_twostep(const char *, char [SIZE(NISSY_SIZE_DATAID)]); | 8 | STATIC long long dataid_twostep(const char *, char [SIZE(NISSY_SIZE_DATAID)]); |
| 4 | STATIC long long gendata_twostep( | 9 | STATIC long long gendata_twostep( |
| 5 | const char *, unsigned long long, unsigned char *); | 10 | const char *, unsigned long long, unsigned char *); |
| @@ -10,6 +15,23 @@ STATIC long long solve_twostep(oriented_cube_t, const char *, unsigned, | |||
| 10 | const unsigned char *, unsigned, char *, | 15 | const unsigned char *, unsigned, char *, |
| 11 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); | 16 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); |
| 12 | 17 | ||
| 18 | STATIC size_t | ||
| 19 | twostep_size_1(void) | ||
| 20 | { | ||
| 21 | size_t s; | ||
| 22 | |||
| 23 | s = gendata_coord(&coordinate_dr, NULL); | ||
| 24 | s = (size_t)8 * DIV_ROUND_UP(s, 8); /* Preserve 8-byte alignment */ | ||
| 25 | |||
| 26 | return s; | ||
| 27 | } | ||
| 28 | |||
| 29 | STATIC size_t | ||
| 30 | twostep_size_2(void) | ||
| 31 | { | ||
| 32 | return gendata_multicoord(&multicoordinate_drfin, NULL); | ||
| 33 | } | ||
| 34 | |||
| 13 | STATIC long long | 35 | STATIC long long |
| 14 | dataid_twostep(const char *s, char dataid[SIZE(NISSY_SIZE_DATAID)]) | 36 | dataid_twostep(const char *s, char dataid[SIZE(NISSY_SIZE_DATAID)]) |
| 15 | { | 37 | { |
| @@ -26,9 +48,8 @@ gendata_twostep( | |||
| 26 | { | 48 | { |
| 27 | size_t r, s1, s2; | 49 | size_t r, s1, s2; |
| 28 | 50 | ||
| 29 | s1 = gendata_coord(&coordinate_dr, NULL); | 51 | s1 = twostep_size_1(); |
| 30 | s1 = DIV_ROUND_UP(s1, 8); /* Preserve 8-byte alignment */ | 52 | s2 = twostep_size_2(); |
| 31 | s2 = gendata_multicoord(&multicoordinate_drfin, NULL); | ||
| 32 | 53 | ||
| 33 | if (buf == NULL) | 54 | if (buf == NULL) |
| 34 | goto gendata_twostep_return_size; | 55 | goto gendata_twostep_return_size; |
| @@ -41,7 +62,7 @@ gendata_twostep( | |||
| 41 | return NISSY_ERROR_UNKNOWN; | 62 | return NISSY_ERROR_UNKNOWN; |
| 42 | 63 | ||
| 43 | r = gendata_multicoord(&multicoordinate_drfin, buf + s1); | 64 | r = gendata_multicoord(&multicoordinate_drfin, buf + s1); |
| 44 | if (r != NISSY_OK) | 65 | if (r == 0) |
| 45 | return NISSY_ERROR_UNKNOWN; | 66 | return NISSY_ERROR_UNKNOWN; |
| 46 | 67 | ||
| 47 | gendata_twostep_return_size: | 68 | gendata_twostep_return_size: |
| @@ -63,7 +84,8 @@ checkdata_twostep( | |||
| 63 | if (r != NISSY_OK) | 84 | if (r != NISSY_OK) |
| 64 | return r; | 85 | return r; |
| 65 | 86 | ||
| 66 | r = checkdata_multicoord(&multicoordinate_drfin, bufsize, buf); | 87 | r = checkdata_multicoord( |
| 88 | &multicoordinate_drfin, bufsize, buf + twostep_size_1()); | ||
| 67 | if (r != NISSY_OK) | 89 | if (r != NISSY_OK) |
| 68 | return r; | 90 | return r; |
| 69 | 91 | ||
| @@ -91,3 +113,5 @@ solve_twostep( | |||
| 91 | { | 113 | { |
| 92 | //TODO | 114 | //TODO |
| 93 | } | 115 | } |
| 116 | |||
| 117 | #endif /* SRC_SOLVERS_TWOSTEP_TWOSTEP_H */ | ||
