From 1f7e8e937d0e71e7eb3b5deab38b34d0a0159d88 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 17 Sep 2026 21:50:34 +0200 Subject: Added include guards --- src/arch/arch.h | 5 +++++ src/arch/avx2.h | 5 +++++ src/arch/common.h | 5 +++++ src/arch/neon.h | 5 +++++ src/arch/portable.h | 5 +++++ src/core/constants.h | 5 +++++ src/core/core.h | 5 +++++ src/core/core_types.h | 5 +++++ src/core/cube.h | 5 +++++ src/core/moves.h | 5 +++++ src/core/oriented_cube.h | 5 +++++ src/core/transform.h | 5 +++++ src/solvers/coord/checkdata.h | 5 +++++ src/solvers/coord/common.h | 5 +++++ src/solvers/coord/coord.h | 5 +++++ src/solvers/coord/corners.h | 5 +++++ src/solvers/coord/cornersx.h | 5 +++++ src/solvers/coord/cpepe.h | 5 +++++ src/solvers/coord/dr.h | 5 +++++ src/solvers/coord/dreo.h | 5 +++++ src/solvers/coord/drfin.h | 5 +++++ src/solvers/coord/drfinnoe.h | 5 +++++ src/solvers/coord/drslice.h | 5 +++++ src/solvers/coord/eo.h | 5 +++++ src/solvers/coord/gendata.h | 5 +++++ src/solvers/coord/htr.h | 5 +++++ src/solvers/coord/list.h | 5 +++++ src/solvers/coord/multisolve.h | 5 +++++ src/solvers/coord/solve.h | 5 +++++ src/solvers/coord/types_macros.h | 5 +++++ src/solvers/coord/utils.h | 5 +++++ src/solvers/dispatch.h | 5 +++++ src/solvers/distribution.h | 5 +++++ src/solvers/h48/checkdata.h | 5 +++++ src/solvers/h48/coordinate.h | 5 +++++ src/solvers/h48/coordinate_types_macros.h | 5 +++++ src/solvers/h48/distribution_h48.h | 5 +++++ src/solvers/h48/gendata_cocsep.h | 5 +++++ src/solvers/h48/gendata_eoesep.h | 5 +++++ src/solvers/h48/gendata_h48.h | 5 +++++ src/solvers/h48/gendata_types_macros.h | 5 +++++ src/solvers/h48/h48.h | 5 +++++ src/solvers/h48/map.h | 5 +++++ src/solvers/h48/map_types_macros.h | 5 +++++ src/solvers/h48/solve.h | 5 +++++ src/solvers/h48/utils.h | 5 +++++ src/solvers/solutions.h | 5 +++++ src/solvers/solutions_types_macros.h | 5 +++++ src/solvers/solvers.h | 5 +++++ src/solvers/tables.h | 5 +++++ src/solvers/tables_types_macros.h | 5 +++++ src/utils/compilers.h | 5 +++++ src/utils/constants.h | 5 +++++ src/utils/dbg_log.h | 5 +++++ src/utils/math.h | 5 +++++ src/utils/prefetch.h | 5 +++++ src/utils/sleep.h | 5 +++++ src/utils/utils.h | 5 +++++ src/utils/wrapthread.h | 5 +++++ 59 files changed, 295 insertions(+) (limited to 'src') diff --git a/src/arch/arch.h b/src/arch/arch.h index aa4a5c5..c4efbd5 100644 --- a/src/arch/arch.h +++ b/src/arch/arch.h @@ -1,3 +1,6 @@ +#ifndef ARCH_ARCH_H +#define ARCH_ARCH_H + #if defined(AVX2) #include @@ -36,3 +39,5 @@ typedef struct { #endif #endif + +#endif /* ARCH_ARCH_H */ diff --git a/src/arch/avx2.h b/src/arch/avx2.h index 801419e..5b9ecc7 100644 --- a/src/arch/avx2.h +++ b/src/arch/avx2.h @@ -1,3 +1,6 @@ +#ifndef ARCH_AVX2_H +#define ARCH_AVX2_H + #define CO2_AVX2 _mm256_set_epi64x(0, 0, 0, INT64_C(0x6060606060606060)) #define COCW_AVX2 _mm256_set_epi64x(0, 0, 0, INT64_C(0x2020202020202020)) #define CP_AVX2 _mm256_set_epi64x(0, 0, 0, INT64_C(0x0707070707070707)) @@ -478,3 +481,5 @@ invcoord_epudsep(uint64_t i) return _mm256_or_si256(elow, cube); } + +#endif /* ARCH_AVX2_H */ diff --git a/src/arch/common.h b/src/arch/common.h index a7c4a3b..973263f 100644 --- a/src/arch/common.h +++ b/src/arch/common.h @@ -1,3 +1,6 @@ +#ifndef ARCH_COMMON_H +#define ARCH_COMMON_H + #define EOSHIFT UINT8_C(4) #define COSHIFT UINT8_C(5) @@ -126,3 +129,5 @@ invcoord_epudsep_array(uint64_t c, uint8_t ret[8]) k -= is; } } + +#endif /* ARCH_COMMON_H */ diff --git a/src/arch/neon.h b/src/arch/neon.h index 501b722..faf3b8f 100644 --- a/src/arch/neon.h +++ b/src/arch/neon.h @@ -1,3 +1,6 @@ +#ifndef ARCH_NEON_H +#define ARCH_NEON_H + #define CO2_NEON vdup_n_u8(0x60) #define COCW_NEON vdup_n_u8(0x20) #define EO_NEON vdupq_n_u8(0x10) @@ -557,3 +560,5 @@ invcoord_epudsep(uint64_t i) .edge = vcombine_u8(vld1_u8(e), vld1_u8(SOLVED_H)) }; } + +#endif /* ARCH_NEON_H */ diff --git a/src/arch/portable.h b/src/arch/portable.h index f1491f0..18fb6b8 100644 --- a/src/arch/portable.h +++ b/src/arch/portable.h @@ -1,3 +1,6 @@ +#ifndef ARCH_PORTABLE_H +#define ARCH_PORTABLE_H + #define STATIC_CUBE(c_ufr, c_ubl, c_dfl, c_dbr, c_ufl, c_ubr, c_dfr, c_dbl, \ e_uf, e_ub, e_db, e_df, e_ur, e_ul, e_dl, e_dr, e_fr, e_fl, e_bl, e_br) \ ((cube_t) { \ @@ -407,3 +410,5 @@ invcoord_epudsep(uint64_t c) invcoord_epudsep_array(c, ret.edge); return ret; } + +#endif /* ARCH_PORTABLE_H */ diff --git a/src/core/constants.h b/src/core/constants.h index 076a483..7e51f67 100644 --- a/src/core/constants.h +++ b/src/core/constants.h @@ -1,3 +1,6 @@ +#ifndef CORE_CONSTANTS_H +#define CORE_CONSTANTS_H + #define ZERO_ORIENTED_CUBE ((oriented_cube_t) {0}) #define SOLVED_ORIENTED_CUBE \ ((oriented_cube_t) { .cube = SOLVED_CUBE, .orientation = 0 }) @@ -913,3 +916,5 @@ STATIC uint8_t basic_to_rotation[] = { [MOVE_B2] = MOVE_z2, [MOVE_B3] = MOVE_z, }; + +#endif /* CORE_CONSTANTS_H */ diff --git a/src/core/core.h b/src/core/core.h index 5e0faaa..d1c0ec1 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -1,6 +1,11 @@ +#ifndef CORE_CORE_H +#define CORE_CORE_H + #include "core_types.h" #include "constants.h" #include "cube.h" #include "moves.h" #include "transform.h" #include "oriented_cube.h" + +#endif /* CORE_CORE_H */ diff --git a/src/core/core_types.h b/src/core/core_types.h index 53cc95e..6f69a8b 100644 --- a/src/core/core_types.h +++ b/src/core/core_types.h @@ -1,3 +1,6 @@ +#ifndef CORE_CORE_TYPES_H +#define CORE_CORE_TYPES_H + typedef struct { cube_t cube; uint8_t orientation; @@ -9,3 +12,5 @@ typedef struct { uint8_t normal[NISSY_SIZE_MOVES]; uint8_t inverse[NISSY_SIZE_MOVES]; } moves_struct_t; + +#endif /* CORE_CORE_TYPES_H */ diff --git a/src/core/cube.h b/src/core/cube.h index 1c21ce1..1dc6b61 100644 --- a/src/core/cube.h +++ b/src/core/cube.h @@ -1,3 +1,6 @@ +#ifndef CORE_CUBE_H +#define CORE_CUBE_H + STATIC bool cube_true(cube_t); STATIC cube_t cubefromarray(uint8_t [SIZE(8)], uint8_t [SIZE(12)]); @@ -369,3 +372,5 @@ cornertob32(uint8_t corner) return val < 26 ? 'A' + (char)val : 'a' + (char)(val - 26); } + +#endif /* CORE_CUBE_H */ diff --git a/src/core/moves.h b/src/core/moves.h index 9f1f7cc..19314de 100644 --- a/src/core/moves.h +++ b/src/core/moves.h @@ -1,3 +1,6 @@ +#ifndef CORE_MOVES_H +#define CORE_MOVES_H + #define MOVE(M, c) compose(c, MOVE_CUBE_ ## M) #define PREMOVE(M, c) compose(MOVE_CUBE_ ## M, c) @@ -719,3 +722,5 @@ unniss_error: LOG("[variations] Error writing result.\n"); return NISSY_ERROR_BUFFER_SIZE; } + +#endif /* CORE_MOVES_H */ diff --git a/src/core/oriented_cube.h b/src/core/oriented_cube.h index 5449204..cc08736 100644 --- a/src/core/oriented_cube.h +++ b/src/core/oriented_cube.h @@ -1,3 +1,6 @@ +#ifndef CORE_ORIENTED_CUBE_H +#define CORE_ORIENTED_CUBE_H + STATIC oriented_cube_t solvedcube(void); STATIC oriented_cube_t move_extended(oriented_cube_t, uint8_t); @@ -75,3 +78,5 @@ applymoves(oriented_cube_t cube, const char *buf) cinv.cube = inverse(cinv.cube); return compose_oriented(cinv, c); } + +#endif /* CORE_ORIENTED_CUBE_H */ diff --git a/src/core/transform.h b/src/core/transform.h index af4634e..1c896e0 100644 --- a/src/core/transform.h +++ b/src/core/transform.h @@ -1,3 +1,6 @@ +#ifndef CORE_TRANSFORM_H +#define CORE_TRANSFORM_H + #define TRANS_EDGES_ROTATION(T, c) \ compose_edges(compose_edges(TRANS_CUBE_ ## T, c), \ TRANS_CUBE_ ## T ## _INVERSE) @@ -418,3 +421,5 @@ symmetry_mask(cube_t cube) return ret; } + +#endif /* CORE_TRANSFORM_H */ 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 @@ +#ifndef SOLVERS_COORD_CHECKDATA_H +#define SOLVERS_COORD_CHECKDATA_H + STATIC long long checkdata_coord_dispatch( const char *, unsigned long long, const unsigned char *); STATIC long long checkdata_coord( @@ -120,3 +123,5 @@ checkdata_multicoord( return NISSY_OK; } + +#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 @@ +#ifndef SOLVERS_COORD_COMMON_H +#define SOLVERS_COORD_COMMON_H + STATIC uint64_t coord_coord_generic( const coord_t [NON_NULL], cube_t, const unsigned char *); STATIC cube_t coord_cube_generic( @@ -229,3 +232,5 @@ coordinate_merge_cpco(cube_t cp, cube_t co) return merged; } + +#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 @@ +#ifndef SOLVERS_COORD_COORD_H +#define SOLVERS_COORD_COORD_H + #include "types_macros.h" #include "common.h" #include "eo.h" @@ -16,3 +19,5 @@ #include "checkdata.h" #include "solve.h" #include "multisolve.h" + +#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 @@ +#ifndef SOLVERS_COORD_CORNERS_H +#define SOLVERS_COORD_CORNERS_H + #define CLASSES_CP_48 984 STATIC uint64_t coordinate_corners_coord(const cube_t, const unsigned char *); @@ -70,3 +73,5 @@ coordinate_corners_gendata(unsigned char *data) { return coord_gendata_generic(&coordinate_corners, data); } + +#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 @@ +#ifndef SOLVERS_COORD_CORNERSX_H +#define SOLVERS_COORD_CORNERSX_H + STATIC bool is_cornersx_solved(uint64_t, const unsigned char *); STATIC coord_t coordinate_cornersx = { @@ -74,3 +77,5 @@ is_cornersx_solved(uint64_t coord, const unsigned char *data) return false; } + +#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 @@ +#ifndef SOLVERS_COORD_CPEPE_H +#define SOLVERS_COORD_CPEPE_H + STATIC uint64_t coordinate_cpepe_coord(const cube_t, const unsigned char *); STATIC cube_t coordinate_cpepe_cube(uint64_t, const unsigned char *); STATIC bool coordinate_cpepe_isnasty(uint64_t, const unsigned char *); @@ -71,3 +74,5 @@ coordinate_cpepe_gendata(unsigned char *data) { return coord_gendata_generic(&coordinate_cpepe, data); } + +#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 @@ +#ifndef SOLVERS_COORD_DR_H +#define SOLVERS_COORD_DR_H + #define DREOESEP_CLASSES UINT64_C(64430) #define DREOESEP_MAX (POW_2_11 * COMB_12_4) @@ -117,3 +120,5 @@ is_eoco_solvable(cube_t cube) { return cocount % 3 == 0 && eocount % 2 == 0; } + +#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 @@ +#ifndef SOLVERS_COORD_DREO_H +#define SOLVERS_COORD_DREO_H + #define DRESEP_CLASSES 81 STATIC uint64_t coord_dresep_nosym(cube_t); @@ -101,3 +104,5 @@ is_dreo_solvable(cube_t cube) { return cocount % 3 == 0; } + +#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 @@ +#ifndef SOLVERS_COORD_DRFIN_H +#define SOLVERS_COORD_DRFIN_H + STATIC bool is_drfin_solvable(cube_t); STATIC multicoord_t multicoordinate_drfin = { @@ -15,3 +18,5 @@ is_drfin_solvable(cube_t cube) coord_co(cube) == 0 && issolvable((oriented_cube_t){.cube = cube, .orientation = 0}); } + +#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 @@ +#ifndef SOLVERS_COORD_DRFINNOE_H +#define SOLVERS_COORD_DRFINNOE_H + /* TODO @@ -96,3 +99,5 @@ is_drfinnoe_solvable(cube_t cube) { coord_eo(transform_edges(cube, TRANS_URr)) == 0 && coord_co(cube) == 0; } + +#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 @@ +#ifndef SOLVERS_COORD_DRSLICE_H +#define SOLVERS_COORD_DRSLICE_H + /* The DRSLICE coordinate is almost identical to DRFINNOE, but it allows for 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) /* Pre-computed coordinates of U D' (= U' D up to trans) and U2 D2 */ return i == 0 || i == 109779816 || i == 68468527; } + +#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 @@ +#ifndef SOLVERS_COORD_EO_H +#define SOLVERS_COORD_EO_H + STATIC uint64_t coordinate_eo_coord(cube_t, const unsigned char *); STATIC cube_t coordinate_eo_cube(uint64_t, const unsigned char *); STATIC bool coordinate_eo_isnasty(uint64_t, const unsigned char *); @@ -57,3 +60,5 @@ coordinate_eo_gendata(unsigned char *data) { return 0; } + +#endif /* SOLVERS_COORD_EO_H */ diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index edf6ce6..0acf9c0 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h @@ -1,3 +1,6 @@ +#ifndef SOLVERS_COORD_GENDATA_H +#define SOLVERS_COORD_GENDATA_H + STATIC size_t gendata_coord(const coord_t [NON_NULL], unsigned char *); STATIC size_t gendata_multicoord( const multicoord_t [NON_NULL], unsigned char *); @@ -353,3 +356,5 @@ set_coord_pval( table[COORD_INDEX(i)] = (table[COORD_INDEX(i)] & (~COORD_MASK(i))) | (val << COORD_SHIFT(i)); } + +#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 @@ +#ifndef SOLVERS_COORD_HTR_H +#define SOLVERS_COORD_HTR_H + STATIC uint64_t coordinate_htr_coord(cube_t, const unsigned char *); STATIC cube_t coordinate_htr_cube(uint64_t, const unsigned char *); STATIC bool coordinate_htr_isnasty(uint64_t, const unsigned char *); @@ -123,3 +126,5 @@ is_cp_htr(uint64_t i, const unsigned char *data) return e == 0 && is_cp16_htr_table[c / 8] & (UINT8_C(1) << (c % 8)); } + +#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 @@ +#ifndef SOLVERS_COORD_LIST_H +#define SOLVERS_COORD_LIST_H + coord_t *all_coordinates[] = { &coordinate_eo, &coordinate_dr, @@ -15,3 +18,5 @@ multicoord_t *all_multicoordinates[] = { &multicoordinate_drfin, NULL }; + +#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 @@ +#ifndef SOLVERS_COORD_MULTISOLVE_H +#define SOLVERS_COORD_MULTISOLVE_H + /* For now the only multicoordinate is DRFIN, and this solver reflects this. For example, NISS is not available. @@ -297,3 +300,5 @@ solve_multicoord_error_unsolvable: LOG("[%s solve] Error: cube not ready\n", mcoord->name); return NISSY_ERROR_UNSOLVABLE_CUBE; } + +#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 @@ +#ifndef SOLVERS_COORD_SOLVE_H +#define SOLVERS_COORD_SOLVE_H + typedef struct { cube_t cube; cube_t inverse; @@ -400,3 +403,5 @@ solve_coord_error_unsolvable: LOG("[%s solve] Error: cube not ready\n", coord->name); return NISSY_ERROR_UNSOLVABLE_CUBE; } + +#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 @@ +#ifndef SOLVERS_COORD_TYPES_MACROS_H +#define SOLVERS_COORD_TYPES_MACROS_H + #define COORD_INDEX(i) ((i)/2) #define COORD_SHIFT(i) (UINT8_C(4) * (uint8_t)((i) % 2)) #define COORD_MASK(i) (UINT8_C(0xF) << COORD_SHIFT(i)) @@ -53,3 +56,5 @@ typedef struct { uint64_t moves_mask; bool (*is_solvable)(cube_t); } multicoord_t; + +#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 @@ +#ifndef SOLVERS_COORD_UTILS_H +#define SOLVERS_COORD_UTILS_H + STATIC coord_t *parse_coord(size_t, const char *); STATIC multicoord_t *parse_multicoord(size_t, const char *); STATIC void parse_coord_and_trans( @@ -80,3 +83,5 @@ dataid_coord(const char *ca, char dataid[SIZE(NISSY_SIZE_DATAID)]) LOG("Error: cannot parse coordinate from '%s'\n", ca); return NISSY_ERROR_INVALID_SOLVER; } + +#endif /* SOLVERS_COORD_UTILS_H */ diff --git a/src/solvers/dispatch.h b/src/solvers/dispatch.h index 810247f..d484736 100644 --- a/src/solvers/dispatch.h +++ b/src/solvers/dispatch.h @@ -1,3 +1,6 @@ +#ifndef SOLVERS_DISPATCH_H +#define SOLVERS_DISPATCH_H + typedef struct { const char *solvername; const char *prefix; @@ -92,3 +95,5 @@ match_solver(const char *name) return solver_dispatchers[i]; } + +#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 @@ +#ifndef SOLVERS_DISTRIBUTION_H +#define SOLVERS_DISTRIBUTION_H + #define ENTRIES_PER_BYTE(k) (UINT64_C(8) / (uint64_t)(k)) #define TABLE_SHIFT(i, k) ((uint8_t)(k) * (uint8_t)((i) % ENTRIES_PER_BYTE(k))) #define TABLE_MASK(i, k) ((UINT8_BIT(k) - UINT8_C(1)) << TABLE_SHIFT(i, k)) @@ -99,3 +102,5 @@ distribution_equal( return wrong == 0; } + +#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 @@ +#ifndef SOLVERS_H48_CHECKDATA_H +#define SOLVERS_H48_CHECKDATA_H + STATIC long long checkdata_h48( const char *, unsigned long long, const unsigned char *); @@ -194,3 +197,5 @@ checkdata_h48( return NISSY_OK; } + +#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 @@ +#ifndef SOLVERS_H48_COORDINATE_H +#define SOLVERS_H48_COORDINATE_H + STATIC_INLINE uint64_t coord_h48( cube_t, const uint32_t [SIZE(COCSEP_TABLESIZE)], uint8_t); STATIC_INLINE uint64_t coord_h48_edges(cube_t, uint64_t, uint8_t, uint8_t); @@ -68,3 +71,5 @@ invcoord_h48( return ret; } + +#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 @@ +#ifndef SOLVERS_H48_COORDINATE_TYPES_MACROS_H +#define SOLVERS_H48_COORDINATE_TYPES_MACROS_H + #define H48_ESIZE(h) ((COMB_12_4 * COMB_8_4) << (uint64_t)(h)) #define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16)) @@ -5,3 +8,5 @@ #define ECLASS(x) COCLASS(x) #define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8)) #define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8)) + +#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 @@ +#ifndef SOLVERS_H48_DISTRIBUTION_H48_H +#define SOLVERS_H48_DISTRIBUTION_H48_H + /* This file is very similar to ../distibution.h, but some adaptations are needed for H48 because of the intertwined fallback table, and it is easier @@ -74,3 +77,5 @@ getdistribution_h48( c = H48_LINE_EXT(H48_COORDMAX(info->h48h)) % H48_LINE_ALLCOORDS; distr[3] -= H48_LINE_COORDS - c; } + +#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 @@ +#ifndef SOLVERS_H48_GENDATA_COCSEP_H +#define SOLVERS_H48_GENDATA_COCSEP_H + STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [NON_NULL]); @@ -164,3 +167,5 @@ get_h48_cdata( return CBOUND(*cdata); } + +#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 @@ +#ifndef SOLVERS_H48_GENDATA_EOESEP_H +#define SOLVERS_H48_GENDATA_EOESEP_H + STATIC uint64_t coord_eoesep_sym(cube_t, const uint32_t [SIZE(ESEP_MAX)]); STATIC size_t gendata_esep_classes( uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]); @@ -280,3 +283,5 @@ set_eoesep_pval( table[EOESEP_INDEX(i)] = (table[EOESEP_INDEX(i)] & (~EOESEP_MASK(i))) | (val << EOESEP_SHIFT(i)); } + +#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 @@ +#ifndef SOLVERS_H48_GENDATA_H48_H +#define SOLVERS_H48_GENDATA_H48_H + STATIC long long gendata_h48_dispatch( const char *, unsigned long long, unsigned char *); STATIC uint64_t gendata_h48short(gendata_h48short_arg_t [NON_NULL]); @@ -547,3 +550,5 @@ get_h48_pval_and_min( *pval_min = tmin >> UINT8_C(4); return (t & H48_MASK(iext)) >> H48_SHIFT(iext); } + +#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 @@ +#ifndef SOLVERS_H48_GENDATA_TYPES_MACROS_H +#define SOLVERS_H48_GENDATA_TYPES_MACROS_H + #define COCSEP_CLASSES ((size_t)3393) #define COCSEP_TABLESIZE ((size_t)POW_3_7 << (size_t)7) #define COCSEP_VISITEDSIZE DIV_ROUND_UP(COCSEP_TABLESIZE, (size_t)8) @@ -116,3 +119,5 @@ typedef struct { wrapthread_atomic unsigned char *table_atomic; wrapthread_define_struct_mutex_t(**table_mutex); } gendata_h48_mark_t; + +#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 @@ +#ifndef SOLVERS_H48_H48_H +#define SOLVERS_H48_H48_H + #include "utils.h" #include "coordinate_types_macros.h" #include "map_types_macros.h" @@ -10,3 +13,5 @@ #include "gendata_h48.h" #include "checkdata.h" #include "solve.h" + +#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 @@ +#ifndef SOLVERS_H48_MAP_H +#define SOLVERS_H48_MAP_H + STATIC void h48map_create(h48map_t [NON_NULL], uint64_t, uint64_t); STATIC void h48map_clear(h48map_t [NON_NULL]); STATIC void h48map_destroy(h48map_t [NON_NULL]); @@ -82,3 +85,5 @@ h48map_nextkvpair(h48map_t map[NON_NULL], uint64_t p[NON_NULL]) return kv; } + +#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 @@ +#ifndef SOLVERS_H48_MAP_TYPES_MACROS_H +#define SOLVERS_H48_MAP_TYPES_MACROS_H + #define MAP_UNSET UINT64_C(0xFFFFFFFFFFFFFFFF) #define MAP_KEYMASK UINT64_C(0xFFFFFFFFFF) #define MAP_KEYSHIFT UINT64_C(40) @@ -14,3 +17,5 @@ typedef struct { uint64_t key; uint64_t val; } kvpair_t; + +#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 @@ +#ifndef SOLVERS_H48_SOLVE_H +#define SOLVERS_H48_SOLVE_H + #define H48_STARTING_MOVES 4 #define H48_STARTING_CUBES 43254 #define H48_SORT_TASKS_MIN_DEPTH 16 @@ -758,3 +761,5 @@ solve_h48_error_data: solve_h48_error_solutions_buffer: return NISSY_ERROR_BUFFER_SIZE; } + +#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 @@ +#ifndef SOLVERS_H48_UTILS_H +#define SOLVERS_H48_UTILS_H + #if SIZE_MAX == UINT64_MAX #define H48_HMAX UINT8_C(11) #else @@ -63,3 +66,5 @@ dataid_h48(const char *str, char buf[SIZE(NISSY_SIZE_DATAID)]) sprintf(buf, "h48h%" PRIu8, h); return NISSY_OK; } + +#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 @@ +#ifndef SOLVERS_SOLUTIONS_H +#define SOLVERS_SOLUTIONS_H + STATIC void solution_moves_reset(solution_moves_t [NON_NULL]); STATIC void solution_moves_transform(solution_moves_t [NON_NULL], size_t, uint8_t); @@ -338,3 +341,5 @@ solutions_done( depth > list->shortest_sol + settings->optimal || list->nsols >= settings->maxsolutions; } + +#endif /* SOLVERS_SOLUTIONS_H */ diff --git a/src/solvers/solutions_types_macros.h b/src/solvers/solutions_types_macros.h index 4727e5a..8454a21 100644 --- a/src/solvers/solutions_types_macros.h +++ b/src/solvers/solutions_types_macros.h @@ -1,3 +1,6 @@ +#ifndef SOLVERS_SOLUTIONS_TYPES_MACROS_H +#define SOLVERS_SOLUTIONS_TYPES_MACROS_H + #define SOLUTION_MAXLEN 20 typedef struct { @@ -22,3 +25,5 @@ typedef struct { size_t used; char *buf; } solution_list_t; + +#endif /* SOLVERS_SOLUTIONS_TYPES_MACROS_H */ diff --git a/src/solvers/solvers.h b/src/solvers/solvers.h index e19b08a..78180aa 100644 --- a/src/solvers/solvers.h +++ b/src/solvers/solvers.h @@ -1,3 +1,6 @@ +#ifndef SOLVERS_SOLVERS_H +#define SOLVERS_SOLVERS_H + #include "solutions_types_macros.h" #include "solutions.h" #include "tables_types_macros.h" @@ -6,3 +9,5 @@ #include "coord/coord.h" #include "h48/h48.h" #include "dispatch.h" + +#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 @@ +#ifndef SOLVERS_TABLES_H +#define SOLVERS_TABLES_H + STATIC uint64_t read_unaligned_u64( const unsigned char [SIZE(sizeof(uint64_t))]); STATIC void write_unaligned_u64( @@ -147,3 +150,5 @@ append_name(tableinfo_t info[NON_NULL], const char *str) info->solver[j] = '\0'; } + +#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 @@ +#ifndef SOLVERS_TABLES_TYPES_MACROS_H +#define SOLVERS_TABLES_TYPES_MACROS_H + #define OFFSET(B, K) (((unsigned char *)B) + K) #define INFOSIZE INT64_C(512) @@ -37,3 +40,5 @@ typedef struct { uint8_t base; uint8_t maxvalue; } tableinfo_t; + +#endif /* SOLVERS_TABLES_TYPES_MACROS_H */ diff --git a/src/utils/compilers.h b/src/utils/compilers.h index 1b175bb..a2ae3ba 100644 --- a/src/utils/compilers.h +++ b/src/utils/compilers.h @@ -1,3 +1,6 @@ +#ifndef UTILS_COMPILERS_H +#define UTILS_COMPILERS_H + #if defined(__GNUC__) #define UNUSED __attribute__((unused)) @@ -22,3 +25,5 @@ a[static N] notation for array parameters). #define NON_NULL #endif + +#endif /* UTILS_COMPILERS_H */ diff --git a/src/utils/constants.h b/src/utils/constants.h index 3eed27d..3d0f6e3 100644 --- a/src/utils/constants.h +++ b/src/utils/constants.h @@ -1,3 +1,6 @@ +#ifndef UTILS_CONSTANTS_H +#define UTILS_CONSTANTS_H + #define UINT8_BIT(i) (UINT8_C(1) << (uint8_t)(i)) #define FACTORIAL_MAX UINT64_C(12) @@ -42,3 +45,5 @@ STATIC uint64_t binomial[12][12] = { {1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1, 0}, {1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1}, }; + +#endif /* UTILS_CONSTANTS_H */ diff --git a/src/utils/dbg_log.h b/src/utils/dbg_log.h index 08d42a3..f22260a 100644 --- a/src/utils/dbg_log.h +++ b/src/utils/dbg_log.h @@ -1,3 +1,6 @@ +#ifndef UTILS_DBG_LOG_H +#define UTILS_DBG_LOG_H + #include void (*nissy_log)(const char *, void *); @@ -31,3 +34,5 @@ write_wrapper(void (*write)(const char *, void *), const char *str, ...) #define DBG_WARN(condition, ...) #define DBG_ASSERT(condition, ...) #endif + +#endif /* UTILS_DBG_LOG_H */ diff --git a/src/utils/math.h b/src/utils/math.h index 0c56861..66ddaed 100644 --- a/src/utils/math.h +++ b/src/utils/math.h @@ -1,3 +1,6 @@ +#ifndef UTILS_MATH_H +#define UTILS_MATH_H + #define SWAP(x, y) do { x ^= y; y ^= x; x ^= y; } while (0) #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) @@ -146,3 +149,5 @@ intpow(double b, uint64_t e) return e % 2 == 0 ? r * r : b * r * r; } + +#endif /* UTILS_MATH_H */ diff --git a/src/utils/prefetch.h b/src/utils/prefetch.h index a2c41ef..30e364e 100644 --- a/src/utils/prefetch.h +++ b/src/utils/prefetch.h @@ -1,3 +1,6 @@ +#ifndef UTILS_PREFETCH_H +#define UTILS_PREFETCH_H + #if defined(__GNUC__) || defined(__clang__) #define prefetch(a, i) __builtin_prefetch(a+i, 0, 0) #elif defined(AVX2) @@ -5,3 +8,5 @@ #else #define prefetch(a, i) (void)i #endif + +#endif /* UTILS_PREFETCH_H */ diff --git a/src/utils/sleep.h b/src/utils/sleep.h index 7c0a84d..28bb807 100644 --- a/src/utils/sleep.h +++ b/src/utils/sleep.h @@ -1,3 +1,6 @@ +#ifndef UTILS_SLEEP_H +#define UTILS_SLEEP_H + #define BASE_SLEEP_TIME 500 STATIC void msleep(int); @@ -50,3 +53,5 @@ msleep(int milliseconds) } #endif + +#endif /* UTILS_SLEEP_H */ diff --git a/src/utils/utils.h b/src/utils/utils.h index e322f20..e320105 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -1,3 +1,6 @@ +#ifndef UTILS_UTILS_H +#define UTILS_UTILS_H + #include "compilers.h" #include "dbg_log.h" #include "constants.h" @@ -5,3 +8,5 @@ #include "sleep.h" #include "wrapthread.h" #include "prefetch.h" + +#endif /* UTILS_UTILS_H */ diff --git a/src/utils/wrapthread.h b/src/utils/wrapthread.h index 9578293..e88eb58 100644 --- a/src/utils/wrapthread.h +++ b/src/utils/wrapthread.h @@ -1,3 +1,6 @@ +#ifndef UTILS_WRAPTHREAD_H +#define UTILS_WRAPTHREAD_H + #if THREADS == 1 #define WRAPTHREAD_NOTHREADS 1 #elif defined(__unix__) @@ -75,3 +78,5 @@ #define wrapthread_mutex_unlock(a) #endif + +#endif /* UTILS_WRAPTHREAD_H */ -- cgit v1.3