From 1964938ca6abef6e5c81d9dccdf42c55abacb5e9 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 5 Nov 2023 16:29:14 +0100 Subject: Refactoring --- cube.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cube.h (limited to 'cube.h') diff --git a/cube.h b/cube.h new file mode 100644 index 0000000..4bbf28a --- /dev/null +++ b/cube.h @@ -0,0 +1,33 @@ +#ifdef CUBE_AVX2 +#include +typedef __m256i cube_t; +#else +typedef struct { + uint8_t c[16]; /* Only the first 8 are used, the rest is padding */ + uint8_t e[16]; /* Only the first 12 are used, the rest is padding */ +} cube_t; +#endif + +typedef uint8_t move_t; +typedef uint8_t trans_t; + +int readmoves(char *, move_t *); +void writemoves(move_t *, int, char *); +trans_t readtrans(char *); +void writetrans(trans_t, char *); + +typedef enum {AVX, H48, SRC} format_t; +cube_t readcube(format_t, char *); /* Supports: H48 */ +void writecube(format_t, cube_t, char *); /* Supports: AVX, H48, SRC */ + +cube_t solvedcube(void); +cube_t zerocube(void); +bool issolvable(cube_t); +bool equal(cube_t, cube_t); +bool issolved(cube_t); +bool iserror(cube_t); + +cube_t move(cube_t, move_t); +cube_t inverse(cube_t); +cube_t compose(cube_t, cube_t); +cube_t transform(cube_t, trans_t); -- cgit v1.3