From 849edbb69700a9f7520e159d94333ef5b798685b Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 8 Dec 2021 21:50:35 +0100 Subject: Just refortmatting and added one type --- src/cubetypes.h | 311 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 162 insertions(+), 149 deletions(-) (limited to 'src/cubetypes.h') diff --git a/src/cubetypes.h b/src/cubetypes.h index f4e682d..ccc2d34 100644 --- a/src/cubetypes.h +++ b/src/cubetypes.h @@ -72,24 +72,25 @@ trans /* Typedefs ******************************************************************/ -typedef struct alg Alg; -typedef struct alglist AlgList; -typedef struct alglistnode AlgListNode; -typedef struct block Block; -typedef struct command Command; -typedef struct commandargs CommandArgs; -typedef struct coordinate Coordinate; -typedef struct cube Cube; -typedef struct cubearray CubeArray; -typedef struct dfsdata DfsData; -typedef struct estimatedata EstimateData; -typedef struct localinfo LocalInfo; -typedef struct piecefilter PieceFilter; -typedef struct prunedata PruneData; -typedef struct solveoptions SolveOptions; -typedef struct step Step; -typedef struct symdata SymData; -typedef struct threaddata ThreadData; +typedef struct alg Alg; +typedef struct alglist AlgList; +typedef struct alglistnode AlgListNode; +typedef struct block Block; +typedef struct command Command; +typedef struct commandargs CommandArgs; +typedef struct coordinate Coordinate; +typedef struct cube Cube; +typedef struct cubearray CubeArray; +typedef struct dfsdata DfsData; +typedef struct estimatedata EstimateData; +typedef struct localinfo LocalInfo; +typedef struct piecefilter PieceFilter; +typedef struct prunedata PruneData; +typedef struct solveoptions SolveOptions; +typedef struct step Step; +typedef struct symdata SymData; +typedef struct threaddatasolve ThreadDataSolve; +typedef struct threaddatagenpt ThreadDataGenpt; typedef Cube (*AntiIndexer) (uint64_t); typedef bool (*Checker) (Cube); @@ -108,221 +109,233 @@ typedef int (*TransFinder) (uint64_t, Trans *); struct alg { - Move * move; - bool * inv; - int len; - int allocated; + Move * move; + bool * inv; + int len; + int allocated; }; struct alglist { - AlgListNode * first; - AlgListNode * last; - int len; + AlgListNode * first; + AlgListNode * last; + int len; }; struct alglistnode { - Alg * alg; - AlgListNode * next; + Alg * alg; + AlgListNode * next; }; struct block { - bool edge[12]; - bool corner[8]; - bool center[6]; + bool edge[12]; + bool corner[8]; + bool center[6]; }; struct command { - char * name; - char * usage; - char * description; - ArgParser parse_args; - Exec exec; + char * name; + char * usage; + char * description; + ArgParser parse_args; + Exec exec; }; struct commandargs { - bool success; - Alg * scramble; - SolveOptions * opts; - Step * step; - Command * command; /* For help */ + bool success; + Alg * scramble; + SolveOptions * opts; + Step * step; + Command * command; /* For help */ }; struct coordinate { - Indexer index; - AntiIndexer cube; - uint64_t max; - TransFinder trans; + Indexer index; + AntiIndexer cube; + uint64_t max; + TransFinder trans; }; struct cube { - int epose; - int eposs; - int eposm; - int eofb; - int eorl; - int eoud; - int cp; - int coud; - int cofb; - int corl; - int cpos; + int epose; + int eposs; + int eposm; + int eofb; + int eorl; + int eoud; + int cp; + int coud; + int cofb; + int corl; + int cpos; }; struct cubearray { - int * ep; - int * eofb; - int * eorl; - int * eoud; - int * cp; - int * coud; - int * corl; - int * cofb; - int * cpos; + int * ep; + int * eofb; + int * eorl; + int * eoud; + int * cp; + int * coud; + int * corl; + int * cofb; + int * cpos; }; struct dfsdata { - int d; - int m; - int lb; - bool niss; - Move last1; - Move last2; - EstimateData * ed; - AlgList * sols; - pthread_mutex_t * sols_mutex; - Alg * current_alg; - Move * sorted_moves; - int * move_position; - uint8_t * visited; + int d; + int m; + int lb; + bool niss; + Move last1; + Move last2; + EstimateData * ed; + AlgList * sols; + pthread_mutex_t * sols_mutex; + Alg * current_alg; + Move * sorted_moves; + int * move_position; + uint8_t * visited; }; struct estimatedata { - Cube cube; - int target; - Move lastmove; - uint64_t movebitmask; - LocalInfo * li; + Cube cube; + int target; + Move lastmove; + uint64_t movebitmask; + LocalInfo * li; }; struct localinfo { - int corners; - int normal_ud; - int normal_fb; - int normal_rl; - int inverse_ud; - int inverse_fb; - int inverse_rl; - int prev_ret; + int corners; + int normal_ud; + int normal_fb; + int normal_rl; + int inverse_ud; + int inverse_fb; + int inverse_rl; + int prev_ret; }; struct piecefilter { - bool epose; - bool eposs; - bool eposm; - bool eofb; - bool eorl; - bool eoud; - bool cp; - bool coud; - bool cofb; - bool corl; - bool cpos; + bool epose; + bool eposs; + bool eposm; + bool eofb; + bool eorl; + bool eoud; + bool cp; + bool coud; + bool cofb; + bool corl; + bool cpos; }; struct prunedata { - char * filename; - uint8_t * ptable; - bool generated; - uint64_t n; - Coordinate * coord; - Moveset moveset; + char * filename; + uint8_t * ptable; + bool generated; + uint64_t n; + Coordinate * coord; + Moveset moveset; }; struct solveoptions { - int min_moves; - int max_moves; - int max_solutions; - int nthreads; - bool optimal_only; - bool can_niss; - bool verbose; - bool all; - bool print_number; + int min_moves; + int max_moves; + int max_solutions; + int nthreads; + bool optimal_only; + bool can_niss; + bool verbose; + bool all; + bool print_number; }; struct step { - char * shortname; - char * name; - Estimator estimate; - Checker ready; - char * ready_msg; - Validator is_valid; - Moveset moveset; - Trans pre_trans; - TransDetector detect; - int ntables; - PruneData * tables[10]; + char * shortname; + char * name; + Estimator estimate; + Checker ready; + char * ready_msg; + Validator is_valid; + Moveset moveset; + Trans pre_trans; + TransDetector detect; + int ntables; + PruneData * tables[10]; }; struct symdata { - char * filename; - bool generated; - Coordinate * coord; - Coordinate * sym_coord; - int ntrans; - Trans * trans; - uint64_t * class; - Cube * rep; - Trans * transtorep; + char * filename; + bool generated; + Coordinate * coord; + Coordinate * sym_coord; + int ntrans; + Trans * trans; + uint64_t * class; + Cube * rep; + Trans * transtorep; }; struct -threaddata +threaddatasolve { - int thid; - Cube cube; - Step * step; - int depth; - Move * sorted_moves; - int * move_position; - SolveOptions * opts; - AlgList * start; - AlgListNode ** node; - AlgList * sols; - pthread_mutex_t * start_mutex; - pthread_mutex_t * sols_mutex; + int thid; + Cube cube; + Step * step; + int depth; + Move * sorted_moves; + int * move_position; + SolveOptions * opts; + AlgList * start; + AlgListNode ** node; + AlgList * sols; + pthread_mutex_t * start_mutex; + pthread_mutex_t * sols_mutex; +}; + +struct +threaddatagenpt +{ + int thid; + PruneData * pd; + int d; + uint64_t rangemin; + uint64_t rangemax; + int nchunks; + pthread_mutex_t ** mutex; }; #endif -- cgit v1.3