diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/_constants.c | 286 | ||||
| -rw-r--r-- | src/_move_logic_avx2.c | 6 | ||||
| -rw-r--r-- | src/_moves_arr.c (renamed from src/_move_logic_arr.c) | 167 | ||||
| -rw-r--r-- | src/_moves_avx2.c | 2 | ||||
| -rw-r--r-- | src/_trans_arr.c | 952 | ||||
| -rw-r--r-- | src/_trans_avx2.c | 0 | ||||
| -rw-r--r-- | src/_trans_move_arr.c | 389 | ||||
| -rw-r--r-- | src/_trans_move_avx2.c | 2 | ||||
| -rw-r--r-- | src/cube.c | 438 | ||||
| -rw-r--r-- | src/cube.h | 3 |
10 files changed, 1470 insertions, 775 deletions
diff --git a/src/_constants.c b/src/_constants.c deleted file mode 100644 index a6b19fe..0000000 --- a/src/_constants.c +++ /dev/null | |||
| @@ -1,286 +0,0 @@ | |||
| 1 | #define U 0U | ||
| 2 | #define U2 1U | ||
| 3 | #define U3 2U | ||
| 4 | #define D 3U | ||
| 5 | #define D2 4U | ||
| 6 | #define D3 5U | ||
| 7 | #define R 6U | ||
| 8 | #define R2 7U | ||
| 9 | #define R3 8U | ||
| 10 | #define L 9U | ||
| 11 | #define L2 10U | ||
| 12 | #define L3 11U | ||
| 13 | #define F 12U | ||
| 14 | #define F2 13U | ||
| 15 | #define F3 14U | ||
| 16 | #define B 15U | ||
| 17 | #define B2 16U | ||
| 18 | #define B3 17U | ||
| 19 | |||
| 20 | #define UFr 0 | ||
| 21 | #define ULr 1 | ||
| 22 | #define UBr 2 | ||
| 23 | #define URr 3 | ||
| 24 | #define DFr 4 | ||
| 25 | #define DLr 5 | ||
| 26 | #define DBr 6 | ||
| 27 | #define DRr 7 | ||
| 28 | #define RUr 8 | ||
| 29 | #define RFr 9 | ||
| 30 | #define RDr 10 | ||
| 31 | #define RBr 11 | ||
| 32 | #define LUr 12 | ||
| 33 | #define LFr 13 | ||
| 34 | #define LDr 14 | ||
| 35 | #define LBr 15 | ||
| 36 | #define FUr 16 | ||
| 37 | #define FRr 17 | ||
| 38 | #define FDr 18 | ||
| 39 | #define FLr 19 | ||
| 40 | #define BUr 20 | ||
| 41 | #define BRr 21 | ||
| 42 | #define BDr 22 | ||
| 43 | #define BLr 23 | ||
| 44 | |||
| 45 | #define UFm 24 | ||
| 46 | #define ULm 25 | ||
| 47 | #define UBm 26 | ||
| 48 | #define URm 27 | ||
| 49 | #define DFm 28 | ||
| 50 | #define DLm 29 | ||
| 51 | #define DBm 30 | ||
| 52 | #define DRm 31 | ||
| 53 | #define RUm 32 | ||
| 54 | #define RFm 33 | ||
| 55 | #define RDm 34 | ||
| 56 | #define RBm 35 | ||
| 57 | #define LUm 36 | ||
| 58 | #define LFm 37 | ||
| 59 | #define LDm 38 | ||
| 60 | #define LBm 39 | ||
| 61 | #define FUm 40 | ||
| 62 | #define FRm 41 | ||
| 63 | #define FDm 42 | ||
| 64 | #define FLm 43 | ||
| 65 | #define BUm 44 | ||
| 66 | #define BRm 45 | ||
| 67 | #define BDm 46 | ||
| 68 | #define BLm 47 | ||
| 69 | |||
| 70 | #define errormove 99U | ||
| 71 | #define errortrans 99U | ||
| 72 | |||
| 73 | #define _c_ufr 0U | ||
| 74 | #define _c_ubl 1U | ||
| 75 | #define _c_dfl 2U | ||
| 76 | #define _c_dbr 3U | ||
| 77 | #define _c_ufl 4U | ||
| 78 | #define _c_ubr 5U | ||
| 79 | #define _c_dfr 6U | ||
| 80 | #define _c_dbl 7U | ||
| 81 | |||
| 82 | #define _e_uf 0U | ||
| 83 | #define _e_ub 1U | ||
| 84 | #define _e_db 2U | ||
| 85 | #define _e_df 3U | ||
| 86 | #define _e_ur 4U | ||
| 87 | #define _e_ul 5U | ||
| 88 | #define _e_dl 6U | ||
| 89 | #define _e_dr 7U | ||
| 90 | #define _e_fr 8U | ||
| 91 | #define _e_fl 9U | ||
| 92 | #define _e_bl 10U | ||
| 93 | #define _e_br 11U | ||
| 94 | |||
| 95 | #define _eoshift 4U | ||
| 96 | #define _coshift 5U | ||
| 97 | |||
| 98 | #define _pbits 0xFU | ||
| 99 | #define _eobit 0x10U | ||
| 100 | #define _cobits 0xF0U | ||
| 101 | #define _cobits2 0x60U | ||
| 102 | #define _ctwist_cw 0x20U | ||
| 103 | #define _ctwist_ccw 0x40U | ||
| 104 | #define _eflip 0x10U | ||
| 105 | #define _error 0xFFU | ||
| 106 | |||
| 107 | static move_t inverse_move_arr[] = { | ||
| 108 | [U] = U3, | ||
| 109 | [U2] = U2, | ||
| 110 | [U3] = U, | ||
| 111 | [D] = D3, | ||
| 112 | [D2] = D2, | ||
| 113 | [D3] = D, | ||
| 114 | [R] = R3, | ||
| 115 | [R2] = R2, | ||
| 116 | [R3] = R, | ||
| 117 | [L] = L3, | ||
| 118 | [L2] = L2, | ||
| 119 | [L3] = L, | ||
| 120 | [F] = F3, | ||
| 121 | [F2] = F2, | ||
| 122 | [F3] = F, | ||
| 123 | [B] = B3, | ||
| 124 | [B2] = B2, | ||
| 125 | [B3] = B, | ||
| 126 | }; | ||
| 127 | |||
| 128 | static trans_t inverse_trans_arr[] = { | ||
| 129 | [UFr] = UFr, | ||
| 130 | [ULr] = URr, | ||
| 131 | [UBr] = UBr, | ||
| 132 | [URr] = URr, | ||
| 133 | [DFr] = DFr, | ||
| 134 | [DLr] = DLr, | ||
| 135 | [DRr] = DRr, | ||
| 136 | [DBr] = DBr, | ||
| 137 | [RUr] = FRr, | ||
| 138 | [RFr] = LFr, | ||
| 139 | [RDr] = BLr, | ||
| 140 | [RBr] = RBr, | ||
| 141 | [LUr] = FLr, | ||
| 142 | [LFr] = RFr, | ||
| 143 | [LDr] = BRr, | ||
| 144 | [LBr] = LBr, | ||
| 145 | [FUr] = FUr, | ||
| 146 | [FRr] = RUr, | ||
| 147 | [FDr] = BUr, | ||
| 148 | [FLr] = LUr, | ||
| 149 | [BUr] = FDr, | ||
| 150 | [BLr] = RDr, | ||
| 151 | [BDr] = BDr, | ||
| 152 | [BRr] = LDr, | ||
| 153 | [UFm] = UFm, | ||
| 154 | [ULm] = ULm, | ||
| 155 | [UBm] = UBm, | ||
| 156 | [URm] = ULm, | ||
| 157 | [DFm] = DFm, | ||
| 158 | [DLm] = DRm, | ||
| 159 | [DRm] = DLm, | ||
| 160 | [DBm] = DBm, | ||
| 161 | [RUm] = FLm, | ||
| 162 | [RFm] = RFm, | ||
| 163 | [RDm] = BRm, | ||
| 164 | [RBm] = LBm, | ||
| 165 | [LUm] = FRm, | ||
| 166 | [LFm] = LFm, | ||
| 167 | [LDm] = BLm, | ||
| 168 | [LBm] = RBm, | ||
| 169 | [FUm] = FUm, | ||
| 170 | [FRm] = LUm, | ||
| 171 | [FDm] = BUm, | ||
| 172 | [FLm] = RUm, | ||
| 173 | [BUm] = FDm, | ||
| 174 | [BLm] = LDm, | ||
| 175 | [BDm] = BDm, | ||
| 176 | [BRm] = RDm, | ||
| 177 | }; | ||
| 178 | |||
| 179 | static char *cornerstr[] = { | ||
| 180 | [_c_ufr] = "UFR", | ||
| 181 | [_c_ubl] = "UBL", | ||
| 182 | [_c_dfl] = "DFL", | ||
| 183 | [_c_dbr] = "DBR", | ||
| 184 | [_c_ufl] = "UFL", | ||
| 185 | [_c_ubr] = "UBR", | ||
| 186 | [_c_dfr] = "DFR", | ||
| 187 | [_c_dbl] = "DBL" | ||
| 188 | }; | ||
| 189 | |||
| 190 | static char *cornerstralt[] = { | ||
| 191 | [_c_ufr] = "URF", | ||
| 192 | [_c_ubl] = "ULB", | ||
| 193 | [_c_dfl] = "DLF", | ||
| 194 | [_c_dbr] = "DRB", | ||
| 195 | [_c_ufl] = "ULF", | ||
| 196 | [_c_ubr] = "URB", | ||
| 197 | [_c_dfr] = "DRF", | ||
| 198 | [_c_dbl] = "DLB" | ||
| 199 | }; | ||
| 200 | |||
| 201 | static char *edgestr[] = { | ||
| 202 | [_e_uf] = "UF", | ||
| 203 | [_e_ub] = "UB", | ||
| 204 | [_e_db] = "DB", | ||
| 205 | [_e_df] = "DF", | ||
| 206 | [_e_ur] = "UR", | ||
| 207 | [_e_ul] = "UL", | ||
| 208 | [_e_dl] = "DL", | ||
| 209 | [_e_dr] = "DR", | ||
| 210 | [_e_fr] = "FR", | ||
| 211 | [_e_fl] = "FL", | ||
| 212 | [_e_bl] = "BL", | ||
| 213 | [_e_br] = "BR" | ||
| 214 | }; | ||
| 215 | |||
| 216 | static char *movestr[] = { | ||
| 217 | [U] = "U", | ||
| 218 | [U2] = "U2", | ||
| 219 | [U3] = "U'", | ||
| 220 | [D] = "D", | ||
| 221 | [D2] = "D2", | ||
| 222 | [D3] = "D'", | ||
| 223 | [R] = "R", | ||
| 224 | [R2] = "R2", | ||
| 225 | [R3] = "R'", | ||
| 226 | [L] = "L", | ||
| 227 | [L2] = "L2", | ||
| 228 | [L3] = "L'", | ||
| 229 | [F] = "F", | ||
| 230 | [F2] = "F2", | ||
| 231 | [F3] = "F'", | ||
| 232 | [B] = "B", | ||
| 233 | [B2] = "B2", | ||
| 234 | [B3] = "B'", | ||
| 235 | }; | ||
| 236 | |||
| 237 | static char *transstr[] = { | ||
| 238 | [UFr] = "rotation UF", | ||
| 239 | [UFm] = "mirrored UF", | ||
| 240 | [ULr] = "rotation UL", | ||
| 241 | [ULm] = "mirrored UL", | ||
| 242 | [UBr] = "rotation UB", | ||
| 243 | [UBm] = "mirrored UB", | ||
| 244 | [URr] = "rotation UR", | ||
| 245 | [URm] = "mirrored UR", | ||
| 246 | [DFr] = "rotation DF", | ||
| 247 | [DFm] = "mirrored DF", | ||
| 248 | [DLr] = "rotation DL", | ||
| 249 | [DLm] = "mirrored DL", | ||
| 250 | [DBr] = "rotation DB", | ||
| 251 | [DBm] = "mirrored DB", | ||
| 252 | [DRr] = "rotation DR", | ||
| 253 | [DRm] = "mirrored DR", | ||
| 254 | [RUr] = "rotation RU", | ||
| 255 | [RUm] = "mirrored RU", | ||
| 256 | [RFr] = "rotation RF", | ||
| 257 | [RFm] = "mirrored RF", | ||
| 258 | [RDr] = "rotation RD", | ||
| 259 | [RDm] = "mirrored RD", | ||
| 260 | [RBr] = "rotation RB", | ||
| 261 | [RBm] = "mirrored RB", | ||
| 262 | [LUr] = "rotation LU", | ||
| 263 | [LUm] = "mirrored LU", | ||
| 264 | [LFr] = "rotation LF", | ||
| 265 | [LFm] = "mirrored LF", | ||
| 266 | [LDr] = "rotation LD", | ||
| 267 | [LDm] = "mirrored LD", | ||
| 268 | [LBr] = "rotation LB", | ||
| 269 | [LBm] = "mirrored LB", | ||
| 270 | [FUr] = "rotation FU", | ||
| 271 | [FUm] = "mirrored FU", | ||
| 272 | [FRr] = "rotation FR", | ||
| 273 | [FRm] = "mirrored FR", | ||
| 274 | [FDr] = "rotation FD", | ||
| 275 | [FDm] = "mirrored FD", | ||
| 276 | [FLr] = "rotation FL", | ||
| 277 | [FLm] = "mirrored FL", | ||
| 278 | [BUr] = "rotation BU", | ||
| 279 | [BUm] = "mirrored BU", | ||
| 280 | [BRr] = "rotation BR", | ||
| 281 | [BRm] = "mirrored BR", | ||
| 282 | [BDr] = "rotation BD", | ||
| 283 | [BDm] = "mirrored BD", | ||
| 284 | [BLr] = "rotation BL", | ||
| 285 | [BLm] = "mirrored BL", | ||
| 286 | }; | ||
diff --git a/src/_move_logic_avx2.c b/src/_move_logic_avx2.c deleted file mode 100644 index 29df776..0000000 --- a/src/_move_logic_avx2.c +++ /dev/null | |||
| @@ -1,6 +0,0 @@ | |||
| 1 | /* TODO: | ||
| 2 | static cube_t move_cube[18]; | ||
| 3 | return compose(move_cube[m], c); | ||
| 4 | */ | ||
| 5 | |||
| 6 | goto move_error; | ||
diff --git a/src/_move_logic_arr.c b/src/_moves_arr.c index d8aec10..bea0fee 100644 --- a/src/_move_logic_arr.c +++ b/src/_moves_arr.c | |||
| @@ -27,79 +27,164 @@ | |||
| 27 | r[k] ^= _eobit; \ | 27 | r[k] ^= _eobit; \ |
| 28 | r[l] ^= _eobit; | 28 | r[l] ^= _eobit; |
| 29 | 29 | ||
| 30 | uint8_t aux, auy, auz; | 30 | static inline cube_t |
| 31 | cube_t ret = c; | 31 | inline_move_U(cube_t c) |
| 32 | { | ||
| 33 | uint8_t aux; | ||
| 34 | cube_t ret = c; | ||
| 32 | 35 | ||
| 33 | switch (m) { | ||
| 34 | case U: | ||
| 35 | PERM4(ret.e, _e_uf, _e_ul, _e_ub, _e_ur) | 36 | PERM4(ret.e, _e_uf, _e_ul, _e_ub, _e_ur) |
| 36 | PERM4(ret.c, _c_ufr, _c_ufl, _c_ubl, _c_ubr) | 37 | PERM4(ret.c, _c_ufr, _c_ufl, _c_ubl, _c_ubr) |
| 37 | 38 | ||
| 38 | return ret; | 39 | return ret; |
| 39 | case U2: | 40 | } |
| 41 | |||
| 42 | static inline cube_t | ||
| 43 | inline_move_U2(cube_t c) | ||
| 44 | { | ||
| 45 | uint8_t aux; | ||
| 46 | cube_t ret = c; | ||
| 47 | |||
| 40 | PERM22(ret.e, _e_uf, _e_ub, _e_ul, _e_ur) | 48 | PERM22(ret.e, _e_uf, _e_ub, _e_ul, _e_ur) |
| 41 | PERM22(ret.c, _c_ufr, _c_ubl, _c_ufl, _c_ubr) | 49 | PERM22(ret.c, _c_ufr, _c_ubl, _c_ufl, _c_ubr) |
| 42 | 50 | ||
| 43 | return ret; | 51 | return ret; |
| 44 | case U3: | 52 | } |
| 53 | |||
| 54 | static inline cube_t | ||
| 55 | inline_move_U3(cube_t c) | ||
| 56 | { | ||
| 57 | uint8_t aux; | ||
| 58 | cube_t ret = c; | ||
| 59 | |||
| 45 | PERM4(ret.e, _e_uf, _e_ur, _e_ub, _e_ul) | 60 | PERM4(ret.e, _e_uf, _e_ur, _e_ub, _e_ul) |
| 46 | PERM4(ret.c, _c_ufr, _c_ubr, _c_ubl, _c_ufl) | 61 | PERM4(ret.c, _c_ufr, _c_ubr, _c_ubl, _c_ufl) |
| 47 | 62 | ||
| 48 | return ret; | 63 | return ret; |
| 49 | case D: | 64 | } |
| 65 | |||
| 66 | static inline cube_t | ||
| 67 | inline_move_D(cube_t c) | ||
| 68 | { | ||
| 69 | uint8_t aux; | ||
| 70 | cube_t ret = c; | ||
| 71 | |||
| 50 | PERM4(ret.e, _e_df, _e_dr, _e_db, _e_dl) | 72 | PERM4(ret.e, _e_df, _e_dr, _e_db, _e_dl) |
| 51 | PERM4(ret.c, _c_dfr, _c_dbr, _c_dbl, _c_dfl) | 73 | PERM4(ret.c, _c_dfr, _c_dbr, _c_dbl, _c_dfl) |
| 52 | 74 | ||
| 53 | return ret; | 75 | return ret; |
| 54 | case D2: | 76 | } |
| 77 | |||
| 78 | static inline cube_t | ||
| 79 | inline_move_D2(cube_t c) | ||
| 80 | { | ||
| 81 | uint8_t aux; | ||
| 82 | cube_t ret = c; | ||
| 83 | |||
| 55 | PERM22(ret.e, _e_df, _e_db, _e_dr, _e_dl) | 84 | PERM22(ret.e, _e_df, _e_db, _e_dr, _e_dl) |
| 56 | PERM22(ret.c, _c_dfr, _c_dbl, _c_dbr, _c_dfl) | 85 | PERM22(ret.c, _c_dfr, _c_dbl, _c_dbr, _c_dfl) |
| 57 | 86 | ||
| 58 | return ret; | 87 | return ret; |
| 59 | case D3: | 88 | } |
| 89 | |||
| 90 | static inline cube_t | ||
| 91 | inline_move_D3(cube_t c) | ||
| 92 | { | ||
| 93 | uint8_t aux; | ||
| 94 | cube_t ret = c; | ||
| 95 | |||
| 60 | PERM4(ret.e, _e_df, _e_dl, _e_db, _e_dr) | 96 | PERM4(ret.e, _e_df, _e_dl, _e_db, _e_dr) |
| 61 | PERM4(ret.c, _c_dfr, _c_dfl, _c_dbl, _c_dbr) | 97 | PERM4(ret.c, _c_dfr, _c_dfl, _c_dbl, _c_dbr) |
| 62 | 98 | ||
| 63 | return ret; | 99 | return ret; |
| 64 | case R: | 100 | } |
| 101 | |||
| 102 | static inline cube_t | ||
| 103 | inline_move_R(cube_t c) | ||
| 104 | { | ||
| 105 | uint8_t aux, auy, auz; | ||
| 106 | cube_t ret = c; | ||
| 107 | |||
| 65 | PERM4(ret.e, _e_ur, _e_br, _e_dr, _e_fr) | 108 | PERM4(ret.e, _e_ur, _e_br, _e_dr, _e_fr) |
| 66 | PERM4(ret.c, _c_ufr, _c_ubr, _c_dbr, _c_dfr) | 109 | PERM4(ret.c, _c_ufr, _c_ubr, _c_dbr, _c_dfr) |
| 67 | 110 | ||
| 68 | CO4(ret.c, _c_ubr, _c_dfr, _c_ufr, _c_dbr) | 111 | CO4(ret.c, _c_ubr, _c_dfr, _c_ufr, _c_dbr) |
| 69 | 112 | ||
| 70 | return ret; | 113 | return ret; |
| 71 | case R2: | 114 | } |
| 115 | |||
| 116 | static inline cube_t | ||
| 117 | inline_move_R2(cube_t c) | ||
| 118 | { | ||
| 119 | uint8_t aux; | ||
| 120 | cube_t ret = c; | ||
| 121 | |||
| 72 | PERM22(ret.e, _e_ur, _e_dr, _e_fr, _e_br) | 122 | PERM22(ret.e, _e_ur, _e_dr, _e_fr, _e_br) |
| 73 | PERM22(ret.c, _c_ufr, _c_dbr, _c_ubr, _c_dfr) | 123 | PERM22(ret.c, _c_ufr, _c_dbr, _c_ubr, _c_dfr) |
| 74 | 124 | ||
| 75 | return ret; | 125 | return ret; |
| 76 | case R3: | 126 | } |
| 127 | |||
| 128 | static inline cube_t | ||
| 129 | inline_move_R3(cube_t c) | ||
| 130 | { | ||
| 131 | uint8_t aux, auy, auz; | ||
| 132 | cube_t ret = c; | ||
| 133 | |||
| 77 | PERM4(ret.e, _e_ur, _e_fr, _e_dr, _e_br) | 134 | PERM4(ret.e, _e_ur, _e_fr, _e_dr, _e_br) |
| 78 | PERM4(ret.c, _c_ufr, _c_dfr, _c_dbr, _c_ubr) | 135 | PERM4(ret.c, _c_ufr, _c_dfr, _c_dbr, _c_ubr) |
| 79 | 136 | ||
| 80 | CO4(ret.c, _c_ubr, _c_dfr, _c_ufr, _c_dbr) | 137 | CO4(ret.c, _c_ubr, _c_dfr, _c_ufr, _c_dbr) |
| 81 | 138 | ||
| 82 | return ret; | 139 | return ret; |
| 83 | case L: | 140 | } |
| 141 | |||
| 142 | static inline cube_t | ||
| 143 | inline_move_L(cube_t c) | ||
| 144 | { | ||
| 145 | uint8_t aux, auy, auz; | ||
| 146 | cube_t ret = c; | ||
| 147 | |||
| 84 | PERM4(ret.e, _e_ul, _e_fl, _e_dl, _e_bl) | 148 | PERM4(ret.e, _e_ul, _e_fl, _e_dl, _e_bl) |
| 85 | PERM4(ret.c, _c_ufl, _c_dfl, _c_dbl, _c_ubl) | 149 | PERM4(ret.c, _c_ufl, _c_dfl, _c_dbl, _c_ubl) |
| 86 | 150 | ||
| 87 | CO4(ret.c, _c_ufl, _c_dbl, _c_dfl, _c_ubl) | 151 | CO4(ret.c, _c_ufl, _c_dbl, _c_dfl, _c_ubl) |
| 88 | 152 | ||
| 89 | return ret; | 153 | return ret; |
| 90 | case L2: | 154 | } |
| 155 | |||
| 156 | static inline cube_t | ||
| 157 | inline_move_L2(cube_t c) | ||
| 158 | { | ||
| 159 | uint8_t aux; | ||
| 160 | cube_t ret = c; | ||
| 161 | |||
| 91 | PERM22(ret.e, _e_ul, _e_dl, _e_fl, _e_bl) | 162 | PERM22(ret.e, _e_ul, _e_dl, _e_fl, _e_bl) |
| 92 | PERM22(ret.c, _c_ufl, _c_dbl, _c_ubl, _c_dfl) | 163 | PERM22(ret.c, _c_ufl, _c_dbl, _c_ubl, _c_dfl) |
| 93 | 164 | ||
| 94 | return ret; | 165 | return ret; |
| 95 | case L3: | 166 | } |
| 167 | |||
| 168 | static inline cube_t | ||
| 169 | inline_move_L3(cube_t c) | ||
| 170 | { | ||
| 171 | uint8_t aux, auy, auz; | ||
| 172 | cube_t ret = c; | ||
| 173 | |||
| 96 | PERM4(ret.e, _e_ul, _e_bl, _e_dl, _e_fl) | 174 | PERM4(ret.e, _e_ul, _e_bl, _e_dl, _e_fl) |
| 97 | PERM4(ret.c, _c_ufl, _c_ubl, _c_dbl, _c_dfl) | 175 | PERM4(ret.c, _c_ufl, _c_ubl, _c_dbl, _c_dfl) |
| 98 | 176 | ||
| 99 | CO4(ret.c, _c_ufl, _c_dbl, _c_dfl, _c_ubl) | 177 | CO4(ret.c, _c_ufl, _c_dbl, _c_dfl, _c_ubl) |
| 100 | 178 | ||
| 101 | return ret; | 179 | return ret; |
| 102 | case F: | 180 | } |
| 181 | |||
| 182 | static inline cube_t | ||
| 183 | inline_move_F(cube_t c) | ||
| 184 | { | ||
| 185 | uint8_t aux, auy, auz; | ||
| 186 | cube_t ret = c; | ||
| 187 | |||
| 103 | PERM4(ret.e, _e_uf, _e_fr, _e_df, _e_fl) | 188 | PERM4(ret.e, _e_uf, _e_fr, _e_df, _e_fl) |
| 104 | PERM4(ret.c, _c_ufr, _c_dfr, _c_dfl, _c_ufl) | 189 | PERM4(ret.c, _c_ufr, _c_dfr, _c_dfl, _c_ufl) |
| 105 | 190 | ||
| @@ -107,12 +192,26 @@ case F: | |||
| 107 | CO4(ret.c, _c_ufr, _c_dfl, _c_dfr, _c_ufl) | 192 | CO4(ret.c, _c_ufr, _c_dfl, _c_dfr, _c_ufl) |
| 108 | 193 | ||
| 109 | return ret; | 194 | return ret; |
| 110 | case F2: | 195 | } |
| 196 | |||
| 197 | static inline cube_t | ||
| 198 | inline_move_F2(cube_t c) | ||
| 199 | { | ||
| 200 | uint8_t aux; | ||
| 201 | cube_t ret = c; | ||
| 202 | |||
| 111 | PERM22(ret.e, _e_uf, _e_df, _e_fr, _e_fl) | 203 | PERM22(ret.e, _e_uf, _e_df, _e_fr, _e_fl) |
| 112 | PERM22(ret.c, _c_ufr, _c_dfl, _c_ufl, _c_dfr) | 204 | PERM22(ret.c, _c_ufr, _c_dfl, _c_ufl, _c_dfr) |
| 113 | 205 | ||
| 114 | return ret; | 206 | return ret; |
| 115 | case F3: | 207 | } |
| 208 | |||
| 209 | static inline cube_t | ||
| 210 | inline_move_F3(cube_t c) | ||
| 211 | { | ||
| 212 | uint8_t aux, auy, auz; | ||
| 213 | cube_t ret = c; | ||
| 214 | |||
| 116 | PERM4(ret.e, _e_uf, _e_fl, _e_df, _e_fr) | 215 | PERM4(ret.e, _e_uf, _e_fl, _e_df, _e_fr) |
| 117 | PERM4(ret.c, _c_ufr, _c_ufl, _c_dfl, _c_dfr) | 216 | PERM4(ret.c, _c_ufr, _c_ufl, _c_dfl, _c_dfr) |
| 118 | 217 | ||
| @@ -120,7 +219,14 @@ case F3: | |||
| 120 | CO4(ret.c, _c_ufr, _c_dfl, _c_dfr, _c_ufl) | 219 | CO4(ret.c, _c_ufr, _c_dfl, _c_dfr, _c_ufl) |
| 121 | 220 | ||
| 122 | return ret; | 221 | return ret; |
| 123 | case B: | 222 | } |
| 223 | |||
| 224 | static inline cube_t | ||
| 225 | inline_move_B(cube_t c) | ||
| 226 | { | ||
| 227 | uint8_t aux, auy, auz; | ||
| 228 | cube_t ret = c; | ||
| 229 | |||
| 124 | PERM4(ret.e, _e_ub, _e_bl, _e_db, _e_br) | 230 | PERM4(ret.e, _e_ub, _e_bl, _e_db, _e_br) |
| 125 | PERM4(ret.c, _c_ubr, _c_ubl, _c_dbl, _c_dbr) | 231 | PERM4(ret.c, _c_ubr, _c_ubl, _c_dbl, _c_dbr) |
| 126 | 232 | ||
| @@ -128,12 +234,26 @@ case B: | |||
| 128 | CO4(ret.c, _c_ubl, _c_dbr, _c_dbl, _c_ubr) | 234 | CO4(ret.c, _c_ubl, _c_dbr, _c_dbl, _c_ubr) |
| 129 | 235 | ||
| 130 | return ret; | 236 | return ret; |
| 131 | case B2: | 237 | } |
| 238 | |||
| 239 | static inline cube_t | ||
| 240 | inline_move_B2(cube_t c) | ||
| 241 | { | ||
| 242 | uint8_t aux; | ||
| 243 | cube_t ret = c; | ||
| 244 | |||
| 132 | PERM22(ret.e, _e_ub, _e_db, _e_br, _e_bl) | 245 | PERM22(ret.e, _e_ub, _e_db, _e_br, _e_bl) |
| 133 | PERM22(ret.c, _c_ubr, _c_dbl, _c_ubl, _c_dbr) | 246 | PERM22(ret.c, _c_ubr, _c_dbl, _c_ubl, _c_dbr) |
| 134 | 247 | ||
| 135 | return ret; | 248 | return ret; |
| 136 | case B3: | 249 | } |
| 250 | |||
| 251 | static inline cube_t | ||
| 252 | inline_move_B3(cube_t c) | ||
| 253 | { | ||
| 254 | uint8_t aux, auy, auz; | ||
| 255 | cube_t ret = c; | ||
| 256 | |||
| 137 | PERM4(ret.e, _e_ub, _e_br, _e_db, _e_bl) | 257 | PERM4(ret.e, _e_ub, _e_br, _e_db, _e_bl) |
| 138 | PERM4(ret.c, _c_ubr, _c_dbr, _c_dbl, _c_ubl) | 258 | PERM4(ret.c, _c_ubr, _c_dbr, _c_dbl, _c_ubl) |
| 139 | 259 | ||
| @@ -141,9 +261,4 @@ case B3: | |||
| 141 | CO4(ret.c, _c_ubl, _c_dbr, _c_dbl, _c_ubr) | 261 | CO4(ret.c, _c_ubl, _c_dbr, _c_dbl, _c_ubr) |
| 142 | 262 | ||
| 143 | return ret; | 263 | return ret; |
| 144 | default: | ||
| 145 | #ifdef DEBUG | ||
| 146 | fprintf(stderr, "mover error, unknown move\n"); | ||
| 147 | #endif | ||
| 148 | goto move_error; | ||
| 149 | } | 264 | } |
diff --git a/src/_moves_avx2.c b/src/_moves_avx2.c new file mode 100644 index 0000000..d72f45f --- /dev/null +++ b/src/_moves_avx2.c | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | /* TODO: return compose(c, (some avx garbage)); | ||
| 2 | */ | ||
diff --git a/src/_trans_arr.c b/src/_trans_arr.c new file mode 100644 index 0000000..3a7c843 --- /dev/null +++ b/src/_trans_arr.c | |||
| @@ -0,0 +1,952 @@ | |||
| 1 | static inline cube_t | ||
| 2 | flipallcorners(cube_t c) | ||
| 3 | { | ||
| 4 | uint8_t i, piece, orien; | ||
| 5 | cube_t ret; | ||
| 6 | |||
| 7 | ret = c; | ||
| 8 | for (i = 0; i < 8; i++) { | ||
| 9 | piece = get_corner(c, i); | ||
| 10 | orien = ((piece << 1) | (piece >> 1)) & _cobits2; | ||
| 11 | set_corner(ret, i, (piece & _pbits) | orien); | ||
| 12 | } | ||
| 13 | |||
| 14 | return ret; | ||
| 15 | } | ||
| 16 | |||
| 17 | static inline cube_t | ||
| 18 | inline_trans_UFr(cube_t c) | ||
| 19 | { | ||
| 20 | cube_t ret; | ||
| 21 | cube_t tn = { | ||
| 22 | .c = {0, 1, 2, 3, 4, 5, 6, 7}, | ||
| 23 | .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} | ||
| 24 | }; | ||
| 25 | cube_t ti = { | ||
| 26 | .c = {0, 1, 2, 3, 4, 5, 6, 7}, | ||
| 27 | .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} | ||
| 28 | }; | ||
| 29 | |||
| 30 | ret = compose(tn, c); | ||
| 31 | ret = compose(ret, ti); | ||
| 32 | |||
| 33 | return ret; | ||
| 34 | } | ||
| 35 | |||
| 36 | static inline cube_t | ||
| 37 | inline_trans_ULr(cube_t c) | ||
| 38 | { | ||
| 39 | cube_t ret; | ||
| 40 | cube_t tn = { | ||
| 41 | .c = {4, 5, 7, 6, 1, 0, 2, 3}, | ||
| 42 | .e = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24} | ||
| 43 | }; | ||
| 44 | cube_t ti = { | ||
| 45 | .c = {5, 4, 6, 7, 0, 1, 3, 2}, | ||
| 46 | .e = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26} | ||
| 47 | }; | ||
| 48 | |||
| 49 | ret = compose(tn, c); | ||
| 50 | ret = compose(ret, ti); | ||
| 51 | |||
| 52 | return ret; | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline cube_t | ||
| 56 | inline_trans_UBr(cube_t c) | ||
| 57 | { | ||
| 58 | cube_t ret; | ||
| 59 | cube_t tn = { | ||
| 60 | .c = {1, 0, 3, 2, 5, 4, 7, 6}, | ||
| 61 | .e = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9} | ||
| 62 | }; | ||
| 63 | cube_t ti = { | ||
| 64 | .c = {1, 0, 3, 2, 5, 4, 7, 6}, | ||
| 65 | .e = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9} | ||
| 66 | }; | ||
| 67 | |||
| 68 | ret = compose(tn, c); | ||
| 69 | ret = compose(ret, ti); | ||
| 70 | |||
| 71 | return ret; | ||
| 72 | } | ||
| 73 | |||
| 74 | static inline cube_t | ||
| 75 | inline_trans_URr(cube_t c) | ||
| 76 | { | ||
| 77 | cube_t ret; | ||
| 78 | cube_t tn = { | ||
| 79 | .c = {5, 4, 6, 7, 0, 1, 3, 2}, | ||
| 80 | .e = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26} | ||
| 81 | }; | ||
| 82 | cube_t ti = { | ||
| 83 | .c = {4, 5, 7, 6, 1, 0, 2, 3}, | ||
| 84 | .e = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24} | ||
| 85 | }; | ||
| 86 | |||
| 87 | ret = compose(tn, c); | ||
| 88 | ret = compose(ret, ti); | ||
| 89 | |||
| 90 | return ret; | ||
| 91 | } | ||
| 92 | |||
| 93 | static inline cube_t | ||
| 94 | inline_trans_DFr(cube_t c) | ||
| 95 | { | ||
| 96 | cube_t ret; | ||
| 97 | cube_t tn = { | ||
| 98 | .c = {2, 3, 0, 1, 6, 7, 4, 5}, | ||
| 99 | .e = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10} | ||
| 100 | }; | ||
| 101 | cube_t ti = { | ||
| 102 | .c = {2, 3, 0, 1, 6, 7, 4, 5}, | ||
| 103 | .e = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10} | ||
| 104 | }; | ||
| 105 | |||
| 106 | ret = compose(tn, c); | ||
| 107 | ret = compose(ret, ti); | ||
| 108 | |||
| 109 | return ret; | ||
| 110 | } | ||
| 111 | |||
| 112 | static inline cube_t | ||
| 113 | inline_trans_DLr(cube_t c) | ||
| 114 | { | ||
| 115 | cube_t ret; | ||
| 116 | cube_t tn = { | ||
| 117 | .c = {7, 6, 4, 5, 2, 3, 1, 0}, | ||
| 118 | .e = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27} | ||
| 119 | }; | ||
| 120 | cube_t ti = { | ||
| 121 | .c = {7, 6, 4, 5, 2, 3, 1, 0}, | ||
| 122 | .e = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27} | ||
| 123 | }; | ||
| 124 | |||
| 125 | ret = compose(tn, c); | ||
| 126 | ret = compose(ret, ti); | ||
| 127 | |||
| 128 | return ret; | ||
| 129 | } | ||
| 130 | |||
| 131 | static inline cube_t | ||
| 132 | inline_trans_DBr(cube_t c) | ||
| 133 | { | ||
| 134 | cube_t ret; | ||
| 135 | cube_t tn = { | ||
| 136 | .c = {3, 2, 1, 0, 7, 6, 5, 4}, | ||
| 137 | .e = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8} | ||
| 138 | }; | ||
| 139 | cube_t ti = { | ||
| 140 | .c = {3, 2, 1, 0, 7, 6, 5, 4}, | ||
| 141 | .e = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8} | ||
| 142 | }; | ||
| 143 | |||
| 144 | ret = compose(tn, c); | ||
| 145 | ret = compose(ret, ti); | ||
| 146 | |||
| 147 | return ret; | ||
| 148 | } | ||
| 149 | |||
| 150 | static inline cube_t | ||
| 151 | inline_trans_DRr(cube_t c) | ||
| 152 | { | ||
| 153 | cube_t ret; | ||
| 154 | cube_t tn = { | ||
| 155 | .c = {6, 7, 5, 4, 3, 2, 0, 1}, | ||
| 156 | .e = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25} | ||
| 157 | }; | ||
| 158 | cube_t ti = { | ||
| 159 | .c = {6, 7, 5, 4, 3, 2, 0, 1}, | ||
| 160 | .e = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25} | ||
| 161 | }; | ||
| 162 | |||
| 163 | ret = compose(tn, c); | ||
| 164 | ret = compose(ret, ti); | ||
| 165 | |||
| 166 | return ret; | ||
| 167 | } | ||
| 168 | |||
| 169 | static inline cube_t | ||
| 170 | inline_trans_RUr(cube_t c) | ||
| 171 | { | ||
| 172 | cube_t ret; | ||
| 173 | cube_t tn = { | ||
| 174 | .c = {64, 67, 65, 66, 37, 38, 36, 39}, | ||
| 175 | .e = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3} | ||
| 176 | }; | ||
| 177 | cube_t ti = { | ||
| 178 | .c = {32, 34, 35, 33, 70, 68, 69, 71}, | ||
| 179 | .e = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21} | ||
| 180 | }; | ||
| 181 | |||
| 182 | ret = compose(tn, c); | ||
| 183 | ret = compose(ret, ti); | ||
| 184 | |||
| 185 | return ret; | ||
| 186 | } | ||
| 187 | |||
| 188 | static inline cube_t | ||
| 189 | inline_trans_RFr(cube_t c) | ||
| 190 | { | ||
| 191 | cube_t ret; | ||
| 192 | cube_t tn = { | ||
| 193 | .c = {38, 37, 36, 39, 64, 67, 66, 65}, | ||
| 194 | .e = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18} | ||
| 195 | }; | ||
| 196 | cube_t ti = { | ||
| 197 | .c = {36, 39, 38, 37, 66, 65, 64, 67}, | ||
| 198 | .e = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17} | ||
| 199 | }; | ||
| 200 | |||
| 201 | ret = compose(tn, c); | ||
| 202 | ret = compose(ret, ti); | ||
| 203 | |||
| 204 | return ret; | ||
| 205 | } | ||
| 206 | |||
| 207 | static inline cube_t | ||
| 208 | inline_trans_RDr(cube_t c) | ||
| 209 | { | ||
| 210 | cube_t ret; | ||
| 211 | cube_t tn = { | ||
| 212 | .c = {67, 64, 66, 65, 38, 37, 39, 36}, | ||
| 213 | .e = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1} | ||
| 214 | }; | ||
| 215 | cube_t ti = { | ||
| 216 | .c = {33, 35, 34, 32, 71, 69, 68, 70}, | ||
| 217 | .e = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20} | ||
| 218 | }; | ||
| 219 | |||
| 220 | ret = compose(tn, c); | ||
| 221 | ret = compose(ret, ti); | ||
| 222 | |||
| 223 | return ret; | ||
| 224 | } | ||
| 225 | |||
| 226 | static inline cube_t | ||
| 227 | inline_trans_RBr(cube_t c) | ||
| 228 | { | ||
| 229 | cube_t ret; | ||
| 230 | cube_t tn = { | ||
| 231 | .c = {37, 38, 39, 36, 67, 64, 65, 66}, | ||
| 232 | .e = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16} | ||
| 233 | }; | ||
| 234 | cube_t ti = { | ||
| 235 | .c = {37, 38, 39, 36, 67, 64, 65, 66}, | ||
| 236 | .e = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16} | ||
| 237 | }; | ||
| 238 | |||
| 239 | ret = compose(tn, c); | ||
| 240 | ret = compose(ret, ti); | ||
| 241 | |||
| 242 | return ret; | ||
| 243 | } | ||
| 244 | |||
| 245 | static inline cube_t | ||
| 246 | inline_trans_LUr(cube_t c) | ||
| 247 | { | ||
| 248 | cube_t ret; | ||
| 249 | cube_t tn = { | ||
| 250 | .c = {65, 66, 64, 67, 36, 39, 37, 38}, | ||
| 251 | .e = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2} | ||
| 252 | }; | ||
| 253 | cube_t ti = { | ||
| 254 | .c = {34, 32, 33, 35, 68, 70, 71, 69}, | ||
| 255 | .e = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23} | ||
| 256 | }; | ||
| 257 | |||
| 258 | ret = compose(tn, c); | ||
| 259 | ret = compose(ret, ti); | ||
| 260 | |||
| 261 | return ret; | ||
| 262 | } | ||
| 263 | |||
| 264 | static inline cube_t | ||
| 265 | inline_trans_LFr(cube_t c) | ||
| 266 | { | ||
| 267 | cube_t ret; | ||
| 268 | cube_t tn = { | ||
| 269 | .c = {36, 39, 38, 37, 66, 65, 64, 67}, | ||
| 270 | .e = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17} | ||
| 271 | }; | ||
| 272 | cube_t ti = { | ||
| 273 | .c = {38, 37, 36, 39, 64, 67, 66, 65}, | ||
| 274 | .e = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18} | ||
| 275 | }; | ||
| 276 | |||
| 277 | ret = compose(tn, c); | ||
| 278 | ret = compose(ret, ti); | ||
| 279 | |||
| 280 | return ret; | ||
| 281 | } | ||
| 282 | |||
| 283 | static inline cube_t | ||
| 284 | inline_trans_LDr(cube_t c) | ||
| 285 | { | ||
| 286 | cube_t ret; | ||
| 287 | cube_t tn = { | ||
| 288 | .c = {66, 65, 67, 64, 39, 36, 38, 37}, | ||
| 289 | .e = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0} | ||
| 290 | }; | ||
| 291 | cube_t ti = { | ||
| 292 | .c = {35, 33, 32, 34, 69, 71, 70, 68}, | ||
| 293 | .e = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22} | ||
| 294 | }; | ||
| 295 | |||
| 296 | ret = compose(tn, c); | ||
| 297 | ret = compose(ret, ti); | ||
| 298 | |||
| 299 | return ret; | ||
| 300 | } | ||
| 301 | |||
| 302 | static inline cube_t | ||
| 303 | inline_trans_LBr(cube_t c) | ||
| 304 | { | ||
| 305 | cube_t ret; | ||
| 306 | cube_t tn = { | ||
| 307 | .c = {39, 36, 37, 38, 65, 66, 67, 64}, | ||
| 308 | .e = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19} | ||
| 309 | }; | ||
| 310 | cube_t ti = { | ||
| 311 | .c = {39, 36, 37, 38, 65, 66, 67, 64}, | ||
| 312 | .e = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19} | ||
| 313 | }; | ||
| 314 | |||
| 315 | ret = compose(tn, c); | ||
| 316 | ret = compose(ret, ti); | ||
| 317 | |||
| 318 | return ret; | ||
| 319 | } | ||
| 320 | |||
| 321 | static inline cube_t | ||
| 322 | inline_trans_FUr(cube_t c) | ||
| 323 | { | ||
| 324 | cube_t ret; | ||
| 325 | cube_t tn = { | ||
| 326 | .c = {68, 70, 69, 71, 32, 34, 33, 35}, | ||
| 327 | .e = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6} | ||
| 328 | }; | ||
| 329 | cube_t ti = { | ||
| 330 | .c = {68, 70, 69, 71, 32, 34, 33, 35}, | ||
| 331 | .e = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6} | ||
| 332 | }; | ||
| 333 | |||
| 334 | ret = compose(tn, c); | ||
| 335 | ret = compose(ret, ti); | ||
| 336 | |||
| 337 | return ret; | ||
| 338 | } | ||
| 339 | |||
| 340 | static inline cube_t | ||
| 341 | inline_trans_FRr(cube_t c) | ||
| 342 | { | ||
| 343 | cube_t ret; | ||
| 344 | cube_t tn = { | ||
| 345 | .c = {32, 34, 35, 33, 70, 68, 69, 71}, | ||
| 346 | .e = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21} | ||
| 347 | }; | ||
| 348 | cube_t ti = { | ||
| 349 | .c = {64, 67, 65, 66, 37, 38, 36, 39}, | ||
| 350 | .e = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3} | ||
| 351 | }; | ||
| 352 | |||
| 353 | ret = compose(tn, c); | ||
| 354 | ret = compose(ret, ti); | ||
| 355 | |||
| 356 | return ret; | ||
| 357 | } | ||
| 358 | |||
| 359 | static inline cube_t | ||
| 360 | inline_trans_FDr(cube_t c) | ||
| 361 | { | ||
| 362 | cube_t ret; | ||
| 363 | cube_t tn = { | ||
| 364 | .c = {70, 68, 71, 69, 34, 32, 35, 33}, | ||
| 365 | .e = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4} | ||
| 366 | }; | ||
| 367 | cube_t ti = { | ||
| 368 | .c = {69, 71, 68, 70, 33, 35, 32, 34}, | ||
| 369 | .e = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7} | ||
| 370 | }; | ||
| 371 | |||
| 372 | ret = compose(tn, c); | ||
| 373 | ret = compose(ret, ti); | ||
| 374 | |||
| 375 | return ret; | ||
| 376 | } | ||
| 377 | |||
| 378 | static inline cube_t | ||
| 379 | inline_trans_FLr(cube_t c) | ||
| 380 | { | ||
| 381 | cube_t ret; | ||
| 382 | cube_t tn = { | ||
| 383 | .c = {34, 32, 33, 35, 68, 70, 71, 69}, | ||
| 384 | .e = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23} | ||
| 385 | }; | ||
| 386 | cube_t ti = { | ||
| 387 | .c = {65, 66, 64, 67, 36, 39, 37, 38}, | ||
| 388 | .e = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2} | ||
| 389 | }; | ||
| 390 | |||
| 391 | ret = compose(tn, c); | ||
| 392 | ret = compose(ret, ti); | ||
| 393 | |||
| 394 | return ret; | ||
| 395 | } | ||
| 396 | |||
| 397 | static inline cube_t | ||
| 398 | inline_trans_BUr(cube_t c) | ||
| 399 | { | ||
| 400 | cube_t ret; | ||
| 401 | cube_t tn = { | ||
| 402 | .c = {69, 71, 68, 70, 33, 35, 32, 34}, | ||
| 403 | .e = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7} | ||
| 404 | }; | ||
| 405 | cube_t ti = { | ||
| 406 | .c = {70, 68, 71, 69, 34, 32, 35, 33}, | ||
| 407 | .e = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4} | ||
| 408 | }; | ||
| 409 | |||
| 410 | ret = compose(tn, c); | ||
| 411 | ret = compose(ret, ti); | ||
| 412 | |||
| 413 | return ret; | ||
| 414 | } | ||
| 415 | |||
| 416 | static inline cube_t | ||
| 417 | inline_trans_BRr(cube_t c) | ||
| 418 | { | ||
| 419 | cube_t ret; | ||
| 420 | cube_t tn = { | ||
| 421 | .c = {35, 33, 32, 34, 69, 71, 70, 68}, | ||
| 422 | .e = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22} | ||
| 423 | }; | ||
| 424 | cube_t ti = { | ||
| 425 | .c = {66, 65, 67, 64, 39, 36, 38, 37}, | ||
| 426 | .e = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0} | ||
| 427 | }; | ||
| 428 | |||
| 429 | ret = compose(tn, c); | ||
| 430 | ret = compose(ret, ti); | ||
| 431 | |||
| 432 | return ret; | ||
| 433 | } | ||
| 434 | |||
| 435 | static inline cube_t | ||
| 436 | inline_trans_BDr(cube_t c) | ||
| 437 | { | ||
| 438 | cube_t ret; | ||
| 439 | cube_t tn = { | ||
| 440 | .c = {71, 69, 70, 68, 35, 33, 34, 32}, | ||
| 441 | .e = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5} | ||
| 442 | }; | ||
| 443 | cube_t ti = { | ||
| 444 | .c = {71, 69, 70, 68, 35, 33, 34, 32}, | ||
| 445 | .e = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5} | ||
| 446 | }; | ||
| 447 | |||
| 448 | ret = compose(tn, c); | ||
| 449 | ret = compose(ret, ti); | ||
| 450 | |||
| 451 | return ret; | ||
| 452 | } | ||
| 453 | |||
| 454 | static inline cube_t | ||
| 455 | inline_trans_BLr(cube_t c) | ||
| 456 | { | ||
| 457 | cube_t ret; | ||
| 458 | cube_t tn = { | ||
| 459 | .c = {33, 35, 34, 32, 71, 69, 68, 70}, | ||
| 460 | .e = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20} | ||
| 461 | }; | ||
| 462 | cube_t ti = { | ||
| 463 | .c = {67, 64, 66, 65, 38, 37, 39, 36}, | ||
| 464 | .e = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1} | ||
| 465 | }; | ||
| 466 | |||
| 467 | ret = compose(tn, c); | ||
| 468 | ret = compose(ret, ti); | ||
| 469 | |||
| 470 | return ret; | ||
| 471 | } | ||
| 472 | |||
| 473 | static inline cube_t | ||
| 474 | inline_trans_UFm(cube_t c) | ||
| 475 | { | ||
| 476 | cube_t ret; | ||
| 477 | cube_t tn = { | ||
| 478 | .c = {4, 5, 6, 7, 0, 1, 2, 3}, | ||
| 479 | .e = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10} | ||
| 480 | }; | ||
| 481 | cube_t ti = { | ||
| 482 | .c = {4, 5, 6, 7, 0, 1, 2, 3}, | ||
| 483 | .e = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10} | ||
| 484 | }; | ||
| 485 | |||
| 486 | ret = compose(tn, c); | ||
| 487 | ret = compose(ret, ti); | ||
| 488 | ret = flipallcorners(ret); | ||
| 489 | |||
| 490 | return ret; | ||
| 491 | } | ||
| 492 | |||
| 493 | static inline cube_t | ||
| 494 | inline_trans_ULm(cube_t c) | ||
| 495 | { | ||
| 496 | cube_t ret; | ||
| 497 | cube_t tn = { | ||
| 498 | .c = {0, 1, 3, 2, 5, 4, 6, 7}, | ||
| 499 | .e = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25} | ||
| 500 | }; | ||
| 501 | cube_t ti = { | ||
| 502 | .c = {0, 1, 3, 2, 5, 4, 6, 7}, | ||
| 503 | .e = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25} | ||
| 504 | }; | ||
| 505 | |||
| 506 | ret = compose(tn, c); | ||
| 507 | ret = compose(ret, ti); | ||
| 508 | ret = flipallcorners(ret); | ||
| 509 | |||
| 510 | return ret; | ||
| 511 | } | ||
| 512 | |||
| 513 | static inline cube_t | ||
| 514 | inline_trans_UBm(cube_t c) | ||
| 515 | { | ||
| 516 | cube_t ret; | ||
| 517 | cube_t tn = { | ||
| 518 | .c = {5, 4, 7, 6, 1, 0, 3, 2}, | ||
| 519 | .e = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8} | ||
| 520 | }; | ||
| 521 | cube_t ti = { | ||
| 522 | .c = {5, 4, 7, 6, 1, 0, 3, 2}, | ||
| 523 | .e = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8} | ||
| 524 | }; | ||
| 525 | |||
| 526 | ret = compose(tn, c); | ||
| 527 | ret = compose(ret, ti); | ||
| 528 | ret = flipallcorners(ret); | ||
| 529 | |||
| 530 | return ret; | ||
| 531 | } | ||
| 532 | |||
| 533 | static inline cube_t | ||
| 534 | inline_trans_URm(cube_t c) | ||
| 535 | { | ||
| 536 | cube_t ret; | ||
| 537 | cube_t tn = { | ||
| 538 | .c = {1, 0, 2, 3, 4, 5, 7, 6}, | ||
| 539 | .e = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27} | ||
| 540 | }; | ||
| 541 | cube_t ti = { | ||
| 542 | .c = {1, 0, 2, 3, 4, 5, 7, 6}, | ||
| 543 | .e = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27} | ||
| 544 | }; | ||
| 545 | |||
| 546 | ret = compose(tn, c); | ||
| 547 | ret = compose(ret, ti); | ||
| 548 | ret = flipallcorners(ret); | ||
| 549 | |||
| 550 | return ret; | ||
| 551 | } | ||
| 552 | |||
| 553 | static inline cube_t | ||
| 554 | inline_trans_DFm(cube_t c) | ||
| 555 | { | ||
| 556 | cube_t ret; | ||
| 557 | cube_t tn = { | ||
| 558 | .c = {6, 7, 4, 5, 2, 3, 0, 1}, | ||
| 559 | .e = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11} | ||
| 560 | }; | ||
| 561 | cube_t ti = { | ||
| 562 | .c = {6, 7, 4, 5, 2, 3, 0, 1}, | ||
| 563 | .e = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11} | ||
| 564 | }; | ||
| 565 | |||
| 566 | ret = compose(tn, c); | ||
| 567 | ret = compose(ret, ti); | ||
| 568 | ret = flipallcorners(ret); | ||
| 569 | |||
| 570 | return ret; | ||
| 571 | } | ||
| 572 | |||
| 573 | static inline cube_t | ||
| 574 | inline_trans_DLm(cube_t c) | ||
| 575 | { | ||
| 576 | cube_t ret; | ||
| 577 | cube_t tn = { | ||
| 578 | .c = {3, 2, 0, 1, 6, 7, 5, 4}, | ||
| 579 | .e = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26} | ||
| 580 | }; | ||
| 581 | cube_t ti = { | ||
| 582 | .c = {2, 3, 1, 0, 7, 6, 4, 5}, | ||
| 583 | .e = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24} | ||
| 584 | }; | ||
| 585 | |||
| 586 | ret = compose(tn, c); | ||
| 587 | ret = compose(ret, ti); | ||
| 588 | ret = flipallcorners(ret); | ||
| 589 | |||
| 590 | return ret; | ||
| 591 | } | ||
| 592 | |||
| 593 | static inline cube_t | ||
| 594 | inline_trans_DBm(cube_t c) | ||
| 595 | { | ||
| 596 | cube_t ret; | ||
| 597 | cube_t tn = { | ||
| 598 | .c = {7, 6, 5, 4, 3, 2, 1, 0}, | ||
| 599 | .e = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9} | ||
| 600 | }; | ||
| 601 | cube_t ti = { | ||
| 602 | .c = {7, 6, 5, 4, 3, 2, 1, 0}, | ||
| 603 | .e = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9} | ||
| 604 | }; | ||
| 605 | |||
| 606 | ret = compose(tn, c); | ||
| 607 | ret = compose(ret, ti); | ||
| 608 | ret = flipallcorners(ret); | ||
| 609 | |||
| 610 | return ret; | ||
| 611 | } | ||
| 612 | |||
| 613 | static inline cube_t | ||
| 614 | inline_trans_DRm(cube_t c) | ||
| 615 | { | ||
| 616 | cube_t ret; | ||
| 617 | cube_t tn = { | ||
| 618 | .c = {2, 3, 1, 0, 7, 6, 4, 5}, | ||
| 619 | .e = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24} | ||
| 620 | }; | ||
| 621 | cube_t ti = { | ||
| 622 | .c = {3, 2, 0, 1, 6, 7, 5, 4}, | ||
| 623 | .e = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26} | ||
| 624 | }; | ||
| 625 | |||
| 626 | ret = compose(tn, c); | ||
| 627 | ret = compose(ret, ti); | ||
| 628 | ret = flipallcorners(ret); | ||
| 629 | |||
| 630 | return ret; | ||
| 631 | } | ||
| 632 | |||
| 633 | static inline cube_t | ||
| 634 | inline_trans_RUm(cube_t c) | ||
| 635 | { | ||
| 636 | cube_t ret; | ||
| 637 | cube_t tn = { | ||
| 638 | .c = {68, 71, 69, 70, 33, 34, 32, 35}, | ||
| 639 | .e = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3} | ||
| 640 | }; | ||
| 641 | cube_t ti = { | ||
| 642 | .c = {70, 68, 69, 71, 32, 34, 35, 33}, | ||
| 643 | .e = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22} | ||
| 644 | }; | ||
| 645 | |||
| 646 | ret = compose(tn, c); | ||
| 647 | ret = compose(ret, ti); | ||
| 648 | ret = flipallcorners(ret); | ||
| 649 | |||
| 650 | return ret; | ||
| 651 | } | ||
| 652 | |||
| 653 | static inline cube_t | ||
| 654 | inline_trans_RFm(cube_t c) | ||
| 655 | { | ||
| 656 | cube_t ret; | ||
| 657 | cube_t tn = { | ||
| 658 | .c = {34, 33, 32, 35, 68, 71, 70, 69}, | ||
| 659 | .e = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18} | ||
| 660 | }; | ||
| 661 | cube_t ti = { | ||
| 662 | .c = {66, 65, 64, 67, 36, 39, 38, 37}, | ||
| 663 | .e = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18} | ||
| 664 | }; | ||
| 665 | |||
| 666 | ret = compose(tn, c); | ||
| 667 | ret = compose(ret, ti); | ||
| 668 | ret = flipallcorners(ret); | ||
| 669 | |||
| 670 | return ret; | ||
| 671 | } | ||
| 672 | |||
| 673 | static inline cube_t | ||
| 674 | inline_trans_RDm(cube_t c) | ||
| 675 | { | ||
| 676 | cube_t ret; | ||
| 677 | cube_t tn = { | ||
| 678 | .c = {71, 68, 70, 69, 34, 33, 35, 32}, | ||
| 679 | .e = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1} | ||
| 680 | }; | ||
| 681 | cube_t ti = { | ||
| 682 | .c = {71, 69, 68, 70, 33, 35, 34, 32}, | ||
| 683 | .e = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23} | ||
| 684 | }; | ||
| 685 | |||
| 686 | ret = compose(tn, c); | ||
| 687 | ret = compose(ret, ti); | ||
| 688 | ret = flipallcorners(ret); | ||
| 689 | |||
| 690 | return ret; | ||
| 691 | } | ||
| 692 | |||
| 693 | static inline cube_t | ||
| 694 | inline_trans_RBm(cube_t c) | ||
| 695 | { | ||
| 696 | cube_t ret; | ||
| 697 | cube_t tn = { | ||
| 698 | .c = {33, 34, 35, 32, 71, 68, 69, 70}, | ||
| 699 | .e = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16} | ||
| 700 | }; | ||
| 701 | cube_t ti = { | ||
| 702 | .c = {67, 64, 65, 66, 37, 38, 39, 36}, | ||
| 703 | .e = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19} | ||
| 704 | }; | ||
| 705 | |||
| 706 | ret = compose(tn, c); | ||
| 707 | ret = compose(ret, ti); | ||
| 708 | ret = flipallcorners(ret); | ||
| 709 | |||
| 710 | return ret; | ||
| 711 | } | ||
| 712 | |||
| 713 | static inline cube_t | ||
| 714 | inline_trans_LUm(cube_t c) | ||
| 715 | { | ||
| 716 | cube_t ret; | ||
| 717 | cube_t tn = { | ||
| 718 | .c = {69, 70, 68, 71, 32, 35, 33, 34}, | ||
| 719 | .e = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2} | ||
| 720 | }; | ||
| 721 | cube_t ti = { | ||
| 722 | .c = {68, 70, 71, 69, 34, 32, 33, 35}, | ||
| 723 | .e = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20} | ||
| 724 | }; | ||
| 725 | |||
| 726 | ret = compose(tn, c); | ||
| 727 | ret = compose(ret, ti); | ||
| 728 | ret = flipallcorners(ret); | ||
| 729 | |||
| 730 | return ret; | ||
| 731 | } | ||
| 732 | |||
| 733 | static inline cube_t | ||
| 734 | inline_trans_LFm(cube_t c) | ||
| 735 | { | ||
| 736 | cube_t ret; | ||
| 737 | cube_t tn = { | ||
| 738 | .c = {32, 35, 34, 33, 70, 69, 68, 71}, | ||
| 739 | .e = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17} | ||
| 740 | }; | ||
| 741 | cube_t ti = { | ||
| 742 | .c = {64, 67, 66, 65, 38, 37, 36, 39}, | ||
| 743 | .e = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17} | ||
| 744 | }; | ||
| 745 | |||
| 746 | ret = compose(tn, c); | ||
| 747 | ret = compose(ret, ti); | ||
| 748 | ret = flipallcorners(ret); | ||
| 749 | |||
| 750 | return ret; | ||
| 751 | } | ||
| 752 | |||
| 753 | static inline cube_t | ||
| 754 | inline_trans_LDm(cube_t c) | ||
| 755 | { | ||
| 756 | cube_t ret; | ||
| 757 | cube_t tn = { | ||
| 758 | .c = {70, 69, 71, 68, 35, 32, 34, 33}, | ||
| 759 | .e = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0} | ||
| 760 | }; | ||
| 761 | cube_t ti = { | ||
| 762 | .c = {69, 71, 70, 68, 35, 33, 32, 34}, | ||
| 763 | .e = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21} | ||
| 764 | }; | ||
| 765 | |||
| 766 | ret = compose(tn, c); | ||
| 767 | ret = compose(ret, ti); | ||
| 768 | ret = flipallcorners(ret); | ||
| 769 | |||
| 770 | return ret; | ||
| 771 | } | ||
| 772 | |||
| 773 | static inline cube_t | ||
| 774 | inline_trans_LBm(cube_t c) | ||
| 775 | { | ||
| 776 | cube_t ret; | ||
| 777 | cube_t tn = { | ||
| 778 | .c = {35, 32, 33, 34, 69, 70, 71, 68}, | ||
| 779 | .e = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19} | ||
| 780 | }; | ||
| 781 | cube_t ti = { | ||
| 782 | .c = {65, 66, 67, 64, 39, 36, 37, 38}, | ||
| 783 | .e = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16} | ||
| 784 | }; | ||
| 785 | |||
| 786 | ret = compose(tn, c); | ||
| 787 | ret = compose(ret, ti); | ||
| 788 | ret = flipallcorners(ret); | ||
| 789 | |||
| 790 | return ret; | ||
| 791 | } | ||
| 792 | |||
| 793 | static inline cube_t | ||
| 794 | inline_trans_FUm(cube_t c) | ||
| 795 | { | ||
| 796 | cube_t ret; | ||
| 797 | cube_t tn = { | ||
| 798 | .c = {64, 66, 65, 67, 36, 38, 37, 39}, | ||
| 799 | .e = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7} | ||
| 800 | }; | ||
| 801 | cube_t ti = { | ||
| 802 | .c = {32, 34, 33, 35, 68, 70, 69, 71}, | ||
| 803 | .e = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7} | ||
| 804 | }; | ||
| 805 | |||
| 806 | ret = compose(tn, c); | ||
| 807 | ret = compose(ret, ti); | ||
| 808 | ret = flipallcorners(ret); | ||
| 809 | |||
| 810 | return ret; | ||
| 811 | } | ||
| 812 | |||
| 813 | static inline cube_t | ||
| 814 | inline_trans_FRm(cube_t c) | ||
| 815 | { | ||
| 816 | cube_t ret; | ||
| 817 | cube_t tn = { | ||
| 818 | .c = {36, 38, 39, 37, 66, 64, 65, 67}, | ||
| 819 | .e = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20} | ||
| 820 | }; | ||
| 821 | cube_t ti = { | ||
| 822 | .c = {37, 38, 36, 39, 64, 67, 65, 66}, | ||
| 823 | .e = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2} | ||
| 824 | }; | ||
| 825 | |||
| 826 | ret = compose(tn, c); | ||
| 827 | ret = compose(ret, ti); | ||
| 828 | ret = flipallcorners(ret); | ||
| 829 | |||
| 830 | return ret; | ||
| 831 | } | ||
| 832 | |||
| 833 | static inline cube_t | ||
| 834 | inline_trans_FDm(cube_t c) | ||
| 835 | { | ||
| 836 | cube_t ret; | ||
| 837 | cube_t tn = { | ||
| 838 | .c = {66, 64, 67, 65, 38, 36, 39, 37}, | ||
| 839 | .e = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5} | ||
| 840 | }; | ||
| 841 | cube_t ti = { | ||
| 842 | .c = {33, 35, 32, 34, 69, 71, 68, 70}, | ||
| 843 | .e = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6} | ||
| 844 | }; | ||
| 845 | |||
| 846 | ret = compose(tn, c); | ||
| 847 | ret = compose(ret, ti); | ||
| 848 | ret = flipallcorners(ret); | ||
| 849 | |||
| 850 | return ret; | ||
| 851 | } | ||
| 852 | |||
| 853 | static inline cube_t | ||
| 854 | inline_trans_FLm(cube_t c) | ||
| 855 | { | ||
| 856 | cube_t ret; | ||
| 857 | cube_t tn = { | ||
| 858 | .c = {38, 36, 37, 39, 64, 66, 67, 65}, | ||
| 859 | .e = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22} | ||
| 860 | }; | ||
| 861 | cube_t ti = { | ||
| 862 | .c = {36, 39, 37, 38, 65, 66, 64, 67}, | ||
| 863 | .e = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3} | ||
| 864 | }; | ||
| 865 | |||
| 866 | ret = compose(tn, c); | ||
| 867 | ret = compose(ret, ti); | ||
| 868 | ret = flipallcorners(ret); | ||
| 869 | |||
| 870 | return ret; | ||
| 871 | } | ||
| 872 | |||
| 873 | static inline cube_t | ||
| 874 | inline_trans_BUm(cube_t c) | ||
| 875 | { | ||
| 876 | cube_t ret; | ||
| 877 | cube_t tn = { | ||
| 878 | .c = {65, 67, 64, 66, 37, 39, 36, 38}, | ||
| 879 | .e = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6} | ||
| 880 | }; | ||
| 881 | cube_t ti = { | ||
| 882 | .c = {34, 32, 35, 33, 70, 68, 71, 69}, | ||
| 883 | .e = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5} | ||
| 884 | }; | ||
| 885 | |||
| 886 | ret = compose(tn, c); | ||
| 887 | ret = compose(ret, ti); | ||
| 888 | ret = flipallcorners(ret); | ||
| 889 | |||
| 890 | return ret; | ||
| 891 | } | ||
| 892 | |||
| 893 | static inline cube_t | ||
| 894 | inline_trans_BRm(cube_t c) | ||
| 895 | { | ||
| 896 | cube_t ret; | ||
| 897 | cube_t tn = { | ||
| 898 | .c = {39, 37, 36, 38, 65, 67, 66, 64}, | ||
| 899 | .e = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23} | ||
| 900 | }; | ||
| 901 | cube_t ti = { | ||
| 902 | .c = {39, 36, 38, 37, 66, 65, 67, 64}, | ||
| 903 | .e = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1} | ||
| 904 | }; | ||
| 905 | |||
| 906 | ret = compose(tn, c); | ||
| 907 | ret = compose(ret, ti); | ||
| 908 | ret = flipallcorners(ret); | ||
| 909 | |||
| 910 | return ret; | ||
| 911 | } | ||
| 912 | |||
| 913 | static inline cube_t | ||
| 914 | inline_trans_BDm(cube_t c) | ||
| 915 | { | ||
| 916 | cube_t ret; | ||
| 917 | cube_t tn = { | ||
| 918 | .c = {67, 65, 66, 64, 39, 37, 38, 36}, | ||
| 919 | .e = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4} | ||
| 920 | }; | ||
| 921 | cube_t ti = { | ||
| 922 | .c = {35, 33, 34, 32, 71, 69, 70, 68}, | ||
| 923 | .e = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4} | ||
| 924 | }; | ||
| 925 | |||
| 926 | ret = compose(tn, c); | ||
| 927 | ret = compose(ret, ti); | ||
| 928 | ret = flipallcorners(ret); | ||
| 929 | |||
| 930 | return ret; | ||
| 931 | } | ||
| 932 | |||
| 933 | static inline cube_t | ||
| 934 | inline_trans_BLm(cube_t c) | ||
| 935 | { | ||
| 936 | cube_t ret; | ||
| 937 | cube_t tn = { | ||
| 938 | .c = {37, 39, 38, 36, 67, 65, 64, 66}, | ||
| 939 | .e = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21} | ||
| 940 | }; | ||
| 941 | cube_t ti = { | ||
| 942 | .c = {38, 37, 39, 36, 67, 64, 66, 65}, | ||
| 943 | .e = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0} | ||
| 944 | }; | ||
| 945 | |||
| 946 | ret = compose(tn, c); | ||
| 947 | ret = compose(ret, ti); | ||
| 948 | ret = flipallcorners(ret); | ||
| 949 | |||
| 950 | return ret; | ||
| 951 | } | ||
| 952 | |||
diff --git a/src/_trans_avx2.c b/src/_trans_avx2.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/_trans_avx2.c | |||
diff --git a/src/_trans_move_arr.c b/src/_trans_move_arr.c deleted file mode 100644 index a00105f..0000000 --- a/src/_trans_move_arr.c +++ /dev/null | |||
| @@ -1,389 +0,0 @@ | |||
| 1 | static cube_t trans_move_cube[] = { | ||
| 2 | [UFr] = { | ||
| 3 | .c = {0, 1, 2, 3, 4, 5, 6, 7}, | ||
| 4 | .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} | ||
| 5 | }, | ||
| 6 | [ULr] = { | ||
| 7 | .c = {4, 5, 7, 6, 1, 0, 2, 3}, | ||
| 8 | .e = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24} | ||
| 9 | }, | ||
| 10 | [UBr] = { | ||
| 11 | .c = {1, 0, 3, 2, 5, 4, 7, 6}, | ||
| 12 | .e = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9} | ||
| 13 | }, | ||
| 14 | [URr] = { | ||
| 15 | .c = {5, 4, 6, 7, 0, 1, 3, 2}, | ||
| 16 | .e = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26} | ||
| 17 | }, | ||
| 18 | [DFr] = { | ||
| 19 | .c = {2, 3, 0, 1, 6, 7, 4, 5}, | ||
| 20 | .e = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10} | ||
| 21 | }, | ||
| 22 | [DLr] = { | ||
| 23 | .c = {7, 6, 4, 5, 2, 3, 1, 0}, | ||
| 24 | .e = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27} | ||
| 25 | }, | ||
| 26 | [DBr] = { | ||
| 27 | .c = {3, 2, 1, 0, 7, 6, 5, 4}, | ||
| 28 | .e = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8} | ||
| 29 | }, | ||
| 30 | [DRr] = { | ||
| 31 | .c = {6, 7, 5, 4, 3, 2, 0, 1}, | ||
| 32 | .e = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25} | ||
| 33 | }, | ||
| 34 | [RUr] = { | ||
| 35 | .c = {64, 67, 65, 66, 37, 38, 36, 39}, | ||
| 36 | .e = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3} | ||
| 37 | }, | ||
| 38 | [RFr] = { | ||
| 39 | .c = {38, 37, 36, 39, 64, 67, 66, 65}, | ||
| 40 | .e = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18} | ||
| 41 | }, | ||
| 42 | [RDr] = { | ||
| 43 | .c = {67, 64, 66, 65, 38, 37, 39, 36}, | ||
| 44 | .e = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1} | ||
| 45 | }, | ||
| 46 | [RBr] = { | ||
| 47 | .c = {37, 38, 39, 36, 67, 64, 65, 66}, | ||
| 48 | .e = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16} | ||
| 49 | }, | ||
| 50 | [LUr] = { | ||
| 51 | .c = {65, 66, 64, 67, 36, 39, 37, 38}, | ||
| 52 | .e = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2} | ||
| 53 | }, | ||
| 54 | [LFr] = { | ||
| 55 | .c = {36, 39, 38, 37, 66, 65, 64, 67}, | ||
| 56 | .e = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17} | ||
| 57 | }, | ||
| 58 | [LDr] = { | ||
| 59 | .c = {66, 65, 67, 64, 39, 36, 38, 37}, | ||
| 60 | .e = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0} | ||
| 61 | }, | ||
| 62 | [LBr] = { | ||
| 63 | .c = {39, 36, 37, 38, 65, 66, 67, 64}, | ||
| 64 | .e = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19} | ||
| 65 | }, | ||
| 66 | [FUr] = { | ||
| 67 | .c = {68, 70, 69, 71, 32, 34, 33, 35}, | ||
| 68 | .e = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6} | ||
| 69 | }, | ||
| 70 | [FRr] = { | ||
| 71 | .c = {32, 34, 35, 33, 70, 68, 69, 71}, | ||
| 72 | .e = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21} | ||
| 73 | }, | ||
| 74 | [FDr] = { | ||
| 75 | .c = {70, 68, 71, 69, 34, 32, 35, 33}, | ||
| 76 | .e = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4} | ||
| 77 | }, | ||
| 78 | [FLr] = { | ||
| 79 | .c = {34, 32, 33, 35, 68, 70, 71, 69}, | ||
| 80 | .e = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23} | ||
| 81 | }, | ||
| 82 | [BUr] = { | ||
| 83 | .c = {69, 71, 68, 70, 33, 35, 32, 34}, | ||
| 84 | .e = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7} | ||
| 85 | }, | ||
| 86 | [BRr] = { | ||
| 87 | .c = {35, 33, 32, 34, 69, 71, 70, 68}, | ||
| 88 | .e = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22} | ||
| 89 | }, | ||
| 90 | [BDr] = { | ||
| 91 | .c = {71, 69, 70, 68, 35, 33, 34, 32}, | ||
| 92 | .e = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5} | ||
| 93 | }, | ||
| 94 | [BLr] = { | ||
| 95 | .c = {33, 35, 34, 32, 71, 69, 68, 70}, | ||
| 96 | .e = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20} | ||
| 97 | }, | ||
| 98 | [UFm] = { | ||
| 99 | .c = {4, 5, 6, 7, 0, 1, 2, 3}, | ||
| 100 | .e = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10} | ||
| 101 | }, | ||
| 102 | [ULm] = { | ||
| 103 | .c = {0, 1, 3, 2, 5, 4, 6, 7}, | ||
| 104 | .e = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25} | ||
| 105 | }, | ||
| 106 | [UBm] = { | ||
| 107 | .c = {5, 4, 7, 6, 1, 0, 3, 2}, | ||
| 108 | .e = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8} | ||
| 109 | }, | ||
| 110 | [URm] = { | ||
| 111 | .c = {1, 0, 2, 3, 4, 5, 7, 6}, | ||
| 112 | .e = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27} | ||
| 113 | }, | ||
| 114 | [DFm] = { | ||
| 115 | .c = {6, 7, 4, 5, 2, 3, 0, 1}, | ||
| 116 | .e = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11} | ||
| 117 | }, | ||
| 118 | [DLm] = { | ||
| 119 | .c = {3, 2, 0, 1, 6, 7, 5, 4}, | ||
| 120 | .e = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26} | ||
| 121 | }, | ||
| 122 | [DBm] = { | ||
| 123 | .c = {7, 6, 5, 4, 3, 2, 1, 0}, | ||
| 124 | .e = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9} | ||
| 125 | }, | ||
| 126 | [DRm] = { | ||
| 127 | .c = {2, 3, 1, 0, 7, 6, 4, 5}, | ||
| 128 | .e = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24} | ||
| 129 | }, | ||
| 130 | [RUm] = { | ||
| 131 | .c = {68, 71, 69, 70, 33, 34, 32, 35}, | ||
| 132 | .e = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3} | ||
| 133 | }, | ||
| 134 | [RFm] = { | ||
| 135 | .c = {34, 33, 32, 35, 68, 71, 70, 69}, | ||
| 136 | .e = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18} | ||
| 137 | }, | ||
| 138 | [RDm] = { | ||
| 139 | .c = {71, 68, 70, 69, 34, 33, 35, 32}, | ||
| 140 | .e = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1} | ||
| 141 | }, | ||
| 142 | [RBm] = { | ||
| 143 | .c = {33, 34, 35, 32, 71, 68, 69, 70}, | ||
| 144 | .e = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16} | ||
| 145 | }, | ||
| 146 | [LUm] = { | ||
| 147 | .c = {69, 70, 68, 71, 32, 35, 33, 34}, | ||
| 148 | .e = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2} | ||
| 149 | }, | ||
| 150 | [LFm] = { | ||
| 151 | .c = {32, 35, 34, 33, 70, 69, 68, 71}, | ||
| 152 | .e = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17} | ||
| 153 | }, | ||
| 154 | [LDm] = { | ||
| 155 | .c = {70, 69, 71, 68, 35, 32, 34, 33}, | ||
| 156 | .e = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0} | ||
| 157 | }, | ||
| 158 | [LBm] = { | ||
| 159 | .c = {35, 32, 33, 34, 69, 70, 71, 68}, | ||
| 160 | .e = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19} | ||
| 161 | }, | ||
| 162 | [FUm] = { | ||
| 163 | .c = {64, 66, 65, 67, 36, 38, 37, 39}, | ||
| 164 | .e = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7} | ||
| 165 | }, | ||
| 166 | [FRm] = { | ||
| 167 | .c = {36, 38, 39, 37, 66, 64, 65, 67}, | ||
| 168 | .e = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20} | ||
| 169 | }, | ||
| 170 | [FDm] = { | ||
| 171 | .c = {66, 64, 67, 65, 38, 36, 39, 37}, | ||
| 172 | .e = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5} | ||
| 173 | }, | ||
| 174 | [FLm] = { | ||
| 175 | .c = {38, 36, 37, 39, 64, 66, 67, 65}, | ||
| 176 | .e = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22} | ||
| 177 | }, | ||
| 178 | [BUm] = { | ||
| 179 | .c = {65, 67, 64, 66, 37, 39, 36, 38}, | ||
| 180 | .e = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6} | ||
| 181 | }, | ||
| 182 | [BRm] = { | ||
| 183 | .c = {39, 37, 36, 38, 65, 67, 66, 64}, | ||
| 184 | .e = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23} | ||
| 185 | }, | ||
| 186 | [BDm] = { | ||
| 187 | .c = {67, 65, 66, 64, 39, 37, 38, 36}, | ||
| 188 | .e = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4} | ||
| 189 | }, | ||
| 190 | [BLm] = { | ||
| 191 | .c = {37, 39, 38, 36, 67, 65, 64, 66}, | ||
| 192 | .e = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21} | ||
| 193 | }, | ||
| 194 | }; | ||
| 195 | |||
| 196 | static cube_t trans_move_cube_inverse[] = { | ||
| 197 | [UFr] = { | ||
| 198 | .c = {0, 1, 2, 3, 4, 5, 6, 7}, | ||
| 199 | .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} | ||
| 200 | }, | ||
| 201 | [ULr] = { | ||
| 202 | .c = {5, 4, 6, 7, 0, 1, 3, 2}, | ||
| 203 | .e = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26} | ||
| 204 | }, | ||
| 205 | [UBr] = { | ||
| 206 | .c = {1, 0, 3, 2, 5, 4, 7, 6}, | ||
| 207 | .e = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9} | ||
| 208 | }, | ||
| 209 | [URr] = { | ||
| 210 | .c = {4, 5, 7, 6, 1, 0, 2, 3}, | ||
| 211 | .e = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24} | ||
| 212 | }, | ||
| 213 | [DFr] = { | ||
| 214 | .c = {2, 3, 0, 1, 6, 7, 4, 5}, | ||
| 215 | .e = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10} | ||
| 216 | }, | ||
| 217 | [DLr] = { | ||
| 218 | .c = {7, 6, 4, 5, 2, 3, 1, 0}, | ||
| 219 | .e = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27} | ||
| 220 | }, | ||
| 221 | [DBr] = { | ||
| 222 | .c = {3, 2, 1, 0, 7, 6, 5, 4}, | ||
| 223 | .e = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8} | ||
| 224 | }, | ||
| 225 | [DRr] = { | ||
| 226 | .c = {6, 7, 5, 4, 3, 2, 0, 1}, | ||
| 227 | .e = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25} | ||
| 228 | }, | ||
| 229 | [RUr] = { | ||
| 230 | .c = {32, 34, 35, 33, 70, 68, 69, 71}, | ||
| 231 | .e = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21} | ||
| 232 | }, | ||
| 233 | [RFr] = { | ||
| 234 | .c = {36, 39, 38, 37, 66, 65, 64, 67}, | ||
| 235 | .e = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17} | ||
| 236 | }, | ||
| 237 | [RDr] = { | ||
| 238 | .c = {33, 35, 34, 32, 71, 69, 68, 70}, | ||
| 239 | .e = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20} | ||
| 240 | }, | ||
| 241 | [RBr] = { | ||
| 242 | .c = {37, 38, 39, 36, 67, 64, 65, 66}, | ||
| 243 | .e = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16} | ||
| 244 | }, | ||
| 245 | [LUr] = { | ||
| 246 | .c = {34, 32, 33, 35, 68, 70, 71, 69}, | ||
| 247 | .e = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23} | ||
| 248 | }, | ||
| 249 | [LFr] = { | ||
| 250 | .c = {38, 37, 36, 39, 64, 67, 66, 65}, | ||
| 251 | .e = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18} | ||
| 252 | }, | ||
| 253 | [LDr] = { | ||
| 254 | .c = {35, 33, 32, 34, 69, 71, 70, 68}, | ||
| 255 | .e = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22} | ||
| 256 | }, | ||
| 257 | [LBr] = { | ||
| 258 | .c = {39, 36, 37, 38, 65, 66, 67, 64}, | ||
| 259 | .e = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19} | ||
| 260 | }, | ||
| 261 | [FUr] = { | ||
| 262 | .c = {68, 70, 69, 71, 32, 34, 33, 35}, | ||
| 263 | .e = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6} | ||
| 264 | }, | ||
| 265 | [FRr] = { | ||
| 266 | .c = {64, 67, 65, 66, 37, 38, 36, 39}, | ||
| 267 | .e = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3} | ||
| 268 | }, | ||
| 269 | [FDr] = { | ||
| 270 | .c = {69, 71, 68, 70, 33, 35, 32, 34}, | ||
| 271 | .e = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7} | ||
| 272 | }, | ||
| 273 | [FLr] = { | ||
| 274 | .c = {65, 66, 64, 67, 36, 39, 37, 38}, | ||
| 275 | .e = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2} | ||
| 276 | }, | ||
| 277 | [BUr] = { | ||
| 278 | .c = {70, 68, 71, 69, 34, 32, 35, 33}, | ||
| 279 | .e = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4} | ||
| 280 | }, | ||
| 281 | [BRr] = { | ||
| 282 | .c = {66, 65, 67, 64, 39, 36, 38, 37}, | ||
| 283 | .e = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0} | ||
| 284 | }, | ||
| 285 | [BDr] = { | ||
| 286 | .c = {71, 69, 70, 68, 35, 33, 34, 32}, | ||
| 287 | .e = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5} | ||
| 288 | }, | ||
| 289 | [BLr] = { | ||
| 290 | .c = {67, 64, 66, 65, 38, 37, 39, 36}, | ||
| 291 | .e = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1} | ||
| 292 | }, | ||
| 293 | [UFm] = { | ||
| 294 | .c = {4, 5, 6, 7, 0, 1, 2, 3}, | ||
| 295 | .e = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10} | ||
| 296 | }, | ||
| 297 | [ULm] = { | ||
| 298 | .c = {0, 1, 3, 2, 5, 4, 6, 7}, | ||
| 299 | .e = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25} | ||
| 300 | }, | ||
| 301 | [UBm] = { | ||
| 302 | .c = {5, 4, 7, 6, 1, 0, 3, 2}, | ||
| 303 | .e = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8} | ||
| 304 | }, | ||
| 305 | [URm] = { | ||
| 306 | .c = {1, 0, 2, 3, 4, 5, 7, 6}, | ||
| 307 | .e = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27} | ||
| 308 | }, | ||
| 309 | [DFm] = { | ||
| 310 | .c = {6, 7, 4, 5, 2, 3, 0, 1}, | ||
| 311 | .e = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11} | ||
| 312 | }, | ||
| 313 | [DLm] = { | ||
| 314 | .c = {2, 3, 1, 0, 7, 6, 4, 5}, | ||
| 315 | .e = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24} | ||
| 316 | }, | ||
| 317 | [DBm] = { | ||
| 318 | .c = {7, 6, 5, 4, 3, 2, 1, 0}, | ||
| 319 | .e = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9} | ||
| 320 | }, | ||
| 321 | [DRm] = { | ||
| 322 | .c = {3, 2, 0, 1, 6, 7, 5, 4}, | ||
| 323 | .e = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26} | ||
| 324 | }, | ||
| 325 | [RUm] = { | ||
| 326 | .c = {70, 68, 69, 71, 32, 34, 35, 33}, | ||
| 327 | .e = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22} | ||
| 328 | }, | ||
| 329 | [RFm] = { | ||
| 330 | .c = {66, 65, 64, 67, 36, 39, 38, 37}, | ||
| 331 | .e = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18} | ||
| 332 | }, | ||
| 333 | [RDm] = { | ||
| 334 | .c = {71, 69, 68, 70, 33, 35, 34, 32}, | ||
| 335 | .e = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23} | ||
| 336 | }, | ||
| 337 | [RBm] = { | ||
| 338 | .c = {67, 64, 65, 66, 37, 38, 39, 36}, | ||
| 339 | .e = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19} | ||
| 340 | }, | ||
| 341 | [LUm] = { | ||
| 342 | .c = {68, 70, 71, 69, 34, 32, 33, 35}, | ||
| 343 | .e = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20} | ||
| 344 | }, | ||
| 345 | [LFm] = { | ||
| 346 | .c = {64, 67, 66, 65, 38, 37, 36, 39}, | ||
| 347 | .e = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17} | ||
| 348 | }, | ||
| 349 | [LDm] = { | ||
| 350 | .c = {69, 71, 70, 68, 35, 33, 32, 34}, | ||
| 351 | .e = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21} | ||
| 352 | }, | ||
| 353 | [LBm] = { | ||
| 354 | .c = {65, 66, 67, 64, 39, 36, 37, 38}, | ||
| 355 | .e = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16} | ||
| 356 | }, | ||
| 357 | [FUm] = { | ||
| 358 | .c = {32, 34, 33, 35, 68, 70, 69, 71}, | ||
| 359 | .e = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7} | ||
| 360 | }, | ||
| 361 | [FRm] = { | ||
| 362 | .c = {37, 38, 36, 39, 64, 67, 65, 66}, | ||
| 363 | .e = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2} | ||
| 364 | }, | ||
| 365 | [FDm] = { | ||
| 366 | .c = {33, 35, 32, 34, 69, 71, 68, 70}, | ||
| 367 | .e = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6} | ||
| 368 | }, | ||
| 369 | [FLm] = { | ||
| 370 | .c = {36, 39, 37, 38, 65, 66, 64, 67}, | ||
| 371 | .e = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3} | ||
| 372 | }, | ||
| 373 | [BUm] = { | ||
| 374 | .c = {34, 32, 35, 33, 70, 68, 71, 69}, | ||
| 375 | .e = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5} | ||
| 376 | }, | ||
| 377 | [BRm] = { | ||
| 378 | .c = {39, 36, 38, 37, 66, 65, 67, 64}, | ||
| 379 | .e = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1} | ||
| 380 | }, | ||
| 381 | [BDm] = { | ||
| 382 | .c = {35, 33, 34, 32, 71, 69, 70, 68}, | ||
| 383 | .e = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4} | ||
| 384 | }, | ||
| 385 | [BLm] = { | ||
| 386 | .c = {38, 37, 39, 36, 67, 64, 66, 65}, | ||
| 387 | .e = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0} | ||
| 388 | }, | ||
| 389 | }; | ||
diff --git a/src/_trans_move_avx2.c b/src/_trans_move_avx2.c deleted file mode 100644 index 38b825e..0000000 --- a/src/_trans_move_avx2.c +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | static cube_t trans_move_cube[48]; | ||
| 2 | static cube_t trans_move_cube_inverse[48]; | ||
| @@ -2,17 +2,121 @@ | |||
| 2 | #include <stdbool.h> | 2 | #include <stdbool.h> |
| 3 | #include <string.h> | 3 | #include <string.h> |
| 4 | 4 | ||
| 5 | #ifdef CUBE_AVX2 | ||
| 6 | #include <immintrin.h> | ||
| 7 | #endif | ||
| 8 | |||
| 9 | #ifdef DEBUG | 5 | #ifdef DEBUG |
| 10 | #include <stdio.h> | 6 | #include <stdio.h> |
| 11 | #endif | 7 | #endif |
| 12 | 8 | ||
| 9 | #ifdef AVX2 | ||
| 10 | #include <immintrin.h> | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #include "cube.h" | 13 | #include "cube.h" |
| 14 | 14 | ||
| 15 | #include "_constants.c" | 15 | #define U 0U |
| 16 | #define U2 1U | ||
| 17 | #define U3 2U | ||
| 18 | #define D 3U | ||
| 19 | #define D2 4U | ||
| 20 | #define D3 5U | ||
| 21 | #define R 6U | ||
| 22 | #define R2 7U | ||
| 23 | #define R3 8U | ||
| 24 | #define L 9U | ||
| 25 | #define L2 10U | ||
| 26 | #define L3 11U | ||
| 27 | #define F 12U | ||
| 28 | #define F2 13U | ||
| 29 | #define F3 14U | ||
| 30 | #define B 15U | ||
| 31 | #define B2 16U | ||
| 32 | #define B3 17U | ||
| 33 | |||
| 34 | #define UFr 0 | ||
| 35 | #define ULr 1 | ||
| 36 | #define UBr 2 | ||
| 37 | #define URr 3 | ||
| 38 | #define DFr 4 | ||
| 39 | #define DLr 5 | ||
| 40 | #define DBr 6 | ||
| 41 | #define DRr 7 | ||
| 42 | #define RUr 8 | ||
| 43 | #define RFr 9 | ||
| 44 | #define RDr 10 | ||
| 45 | #define RBr 11 | ||
| 46 | #define LUr 12 | ||
| 47 | #define LFr 13 | ||
| 48 | #define LDr 14 | ||
| 49 | #define LBr 15 | ||
| 50 | #define FUr 16 | ||
| 51 | #define FRr 17 | ||
| 52 | #define FDr 18 | ||
| 53 | #define FLr 19 | ||
| 54 | #define BUr 20 | ||
| 55 | #define BRr 21 | ||
| 56 | #define BDr 22 | ||
| 57 | #define BLr 23 | ||
| 58 | |||
| 59 | #define UFm 24 | ||
| 60 | #define ULm 25 | ||
| 61 | #define UBm 26 | ||
| 62 | #define URm 27 | ||
| 63 | #define DFm 28 | ||
| 64 | #define DLm 29 | ||
| 65 | #define DBm 30 | ||
| 66 | #define DRm 31 | ||
| 67 | #define RUm 32 | ||
| 68 | #define RFm 33 | ||
| 69 | #define RDm 34 | ||
| 70 | #define RBm 35 | ||
| 71 | #define LUm 36 | ||
| 72 | #define LFm 37 | ||
| 73 | #define LDm 38 | ||
| 74 | #define LBm 39 | ||
| 75 | #define FUm 40 | ||
| 76 | #define FRm 41 | ||
| 77 | #define FDm 42 | ||
| 78 | #define FLm 43 | ||
| 79 | #define BUm 44 | ||
| 80 | #define BRm 45 | ||
| 81 | #define BDm 46 | ||
| 82 | #define BLm 47 | ||
| 83 | |||
| 84 | #define errormove 99U | ||
| 85 | #define errortrans 99U | ||
| 86 | |||
| 87 | #define _c_ufr 0U | ||
| 88 | #define _c_ubl 1U | ||
| 89 | #define _c_dfl 2U | ||
| 90 | #define _c_dbr 3U | ||
| 91 | #define _c_ufl 4U | ||
| 92 | #define _c_ubr 5U | ||
| 93 | #define _c_dfr 6U | ||
| 94 | #define _c_dbl 7U | ||
| 95 | |||
| 96 | #define _e_uf 0U | ||
| 97 | #define _e_ub 1U | ||
| 98 | #define _e_db 2U | ||
| 99 | #define _e_df 3U | ||
| 100 | #define _e_ur 4U | ||
| 101 | #define _e_ul 5U | ||
| 102 | #define _e_dl 6U | ||
| 103 | #define _e_dr 7U | ||
| 104 | #define _e_fr 8U | ||
| 105 | #define _e_fl 9U | ||
| 106 | #define _e_bl 10U | ||
| 107 | #define _e_br 11U | ||
| 108 | |||
| 109 | #define _eoshift 4U | ||
| 110 | #define _coshift 5U | ||
| 111 | |||
| 112 | #define _pbits 0xFU | ||
| 113 | #define _eobit 0x10U | ||
| 114 | #define _cobits 0xF0U | ||
| 115 | #define _cobits2 0x60U | ||
| 116 | #define _ctwist_cw 0x20U | ||
| 117 | #define _ctwist_ccw 0x40U | ||
| 118 | #define _eflip 0x10U | ||
| 119 | #define _error 0xFFU | ||
| 16 | 120 | ||
| 17 | cube_arr_t solvedcube_arr = { | 121 | cube_arr_t solvedcube_arr = { |
| 18 | .c = {0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0}, | 122 | .c = {0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0}, |
| @@ -36,18 +140,133 @@ cube_arr_t zerocube_arr = { .e = {0}, .c = {0} }; | |||
| 36 | _mm256_andnot_si256(cube, _mm256_slli_si256(_c, 0)), \ | 140 | _mm256_andnot_si256(cube, _mm256_slli_si256(_c, 0)), \ |
| 37 | _mm256_and_si256(_mm256_set1_epi8(p), _mm256_slli_si256(_c, 0))) | 141 | _mm256_and_si256(_mm256_set1_epi8(p), _mm256_slli_si256(_c, 0))) |
| 38 | 142 | ||
| 143 | #include "_moves_avx2.c" | ||
| 144 | #include "_trans_avx2.c" | ||
| 145 | |||
| 39 | #else | 146 | #else |
| 40 | 147 | ||
| 41 | #define setsolved(cube) cube = solvedcube_arr | 148 | #define setsolved(cube) cube = solvedcube_arr |
| 42 | #define setzero(cube) cube = zerocube_arr | 149 | #define setzero(cube) cube = zerocube_arr |
| 43 | #define _c _mm256_set_epi64x(0, 0, 0, 0xFF) | ||
| 44 | #define get_edge(cube, i) (cube).e[(i)] | 150 | #define get_edge(cube, i) (cube).e[(i)] |
| 45 | #define get_corner(cube, i) (cube).c[(i)] | 151 | #define get_corner(cube, i) (cube).c[(i)] |
| 46 | #define set_edge(cube, i, p) (cube).e[(i)] = (p) | 152 | #define set_edge(cube, i, p) (cube).e[(i)] = (p) |
| 47 | #define set_corner(cube, i, p) (cube).c[(i)] = (p) | 153 | #define set_corner(cube, i, p) (cube).c[(i)] = (p) |
| 48 | 154 | ||
| 155 | #include "_moves_arr.c" | ||
| 156 | #include "_trans_arr.c" | ||
| 157 | |||
| 49 | #endif | 158 | #endif |
| 50 | 159 | ||
| 160 | |||
| 161 | static char *cornerstr[] = { | ||
| 162 | [_c_ufr] = "UFR", | ||
| 163 | [_c_ubl] = "UBL", | ||
| 164 | [_c_dfl] = "DFL", | ||
| 165 | [_c_dbr] = "DBR", | ||
| 166 | [_c_ufl] = "UFL", | ||
| 167 | [_c_ubr] = "UBR", | ||
| 168 | [_c_dfr] = "DFR", | ||
| 169 | [_c_dbl] = "DBL" | ||
| 170 | }; | ||
| 171 | |||
| 172 | static char *cornerstralt[] = { | ||
| 173 | [_c_ufr] = "URF", | ||
| 174 | [_c_ubl] = "ULB", | ||
| 175 | [_c_dfl] = "DLF", | ||
| 176 | [_c_dbr] = "DRB", | ||
| 177 | [_c_ufl] = "ULF", | ||
| 178 | [_c_ubr] = "URB", | ||
| 179 | [_c_dfr] = "DRF", | ||
| 180 | [_c_dbl] = "DLB" | ||
| 181 | }; | ||
| 182 | |||
| 183 | static char *edgestr[] = { | ||
| 184 | [_e_uf] = "UF", | ||
| 185 | [_e_ub] = "UB", | ||
| 186 | [_e_db] = "DB", | ||
| 187 | [_e_df] = "DF", | ||
| 188 | [_e_ur] = "UR", | ||
| 189 | [_e_ul] = "UL", | ||
| 190 | [_e_dl] = "DL", | ||
| 191 | [_e_dr] = "DR", | ||
| 192 | [_e_fr] = "FR", | ||
| 193 | [_e_fl] = "FL", | ||
| 194 | [_e_bl] = "BL", | ||
| 195 | [_e_br] = "BR" | ||
| 196 | }; | ||
| 197 | |||
| 198 | static char *movestr[] = { | ||
| 199 | [U] = "U", | ||
| 200 | [U2] = "U2", | ||
| 201 | [U3] = "U'", | ||
| 202 | [D] = "D", | ||
| 203 | [D2] = "D2", | ||
| 204 | [D3] = "D'", | ||
| 205 | [R] = "R", | ||
| 206 | [R2] = "R2", | ||
| 207 | [R3] = "R'", | ||
| 208 | [L] = "L", | ||
| 209 | [L2] = "L2", | ||
| 210 | [L3] = "L'", | ||
| 211 | [F] = "F", | ||
| 212 | [F2] = "F2", | ||
| 213 | [F3] = "F'", | ||
| 214 | [B] = "B", | ||
| 215 | [B2] = "B2", | ||
| 216 | [B3] = "B'", | ||
| 217 | }; | ||
| 218 | |||
| 219 | static char *transstr[] = { | ||
| 220 | [UFr] = "rotation UF", | ||
| 221 | [UFm] = "mirrored UF", | ||
| 222 | [ULr] = "rotation UL", | ||
| 223 | [ULm] = "mirrored UL", | ||
| 224 | [UBr] = "rotation UB", | ||
| 225 | [UBm] = "mirrored UB", | ||
| 226 | [URr] = "rotation UR", | ||
| 227 | [URm] = "mirrored UR", | ||
| 228 | [DFr] = "rotation DF", | ||
| 229 | [DFm] = "mirrored DF", | ||
| 230 | [DLr] = "rotation DL", | ||
| 231 | [DLm] = "mirrored DL", | ||
| 232 | [DBr] = "rotation DB", | ||
| 233 | [DBm] = "mirrored DB", | ||
| 234 | [DRr] = "rotation DR", | ||
| 235 | [DRm] = "mirrored DR", | ||
| 236 | [RUr] = "rotation RU", | ||
| 237 | [RUm] = "mirrored RU", | ||
| 238 | [RFr] = "rotation RF", | ||
| 239 | [RFm] = "mirrored RF", | ||
| 240 | [RDr] = "rotation RD", | ||
| 241 | [RDm] = "mirrored RD", | ||
| 242 | [RBr] = "rotation RB", | ||
| 243 | [RBm] = "mirrored RB", | ||
| 244 | [LUr] = "rotation LU", | ||
| 245 | [LUm] = "mirrored LU", | ||
| 246 | [LFr] = "rotation LF", | ||
| 247 | [LFm] = "mirrored LF", | ||
| 248 | [LDr] = "rotation LD", | ||
| 249 | [LDm] = "mirrored LD", | ||
| 250 | [LBr] = "rotation LB", | ||
| 251 | [LBm] = "mirrored LB", | ||
| 252 | [FUr] = "rotation FU", | ||
| 253 | [FUm] = "mirrored FU", | ||
| 254 | [FRr] = "rotation FR", | ||
| 255 | [FRm] = "mirrored FR", | ||
| 256 | [FDr] = "rotation FD", | ||
| 257 | [FDm] = "mirrored FD", | ||
| 258 | [FLr] = "rotation FL", | ||
| 259 | [FLm] = "mirrored FL", | ||
| 260 | [BUr] = "rotation BU", | ||
| 261 | [BUm] = "mirrored BU", | ||
| 262 | [BRr] = "rotation BR", | ||
| 263 | [BRm] = "mirrored BR", | ||
| 264 | [BDr] = "rotation BD", | ||
| 265 | [BDm] = "mirrored BD", | ||
| 266 | [BLr] = "rotation BL", | ||
| 267 | [BLm] = "mirrored BL", | ||
| 268 | }; | ||
| 269 | |||
| 51 | static bool isconsistent(cube_t); | 270 | static bool isconsistent(cube_t); |
| 52 | static cube_t flipallcorners(cube_t); | 271 | static cube_t flipallcorners(cube_t); |
| 53 | static uint8_t readco(char *); | 272 | static uint8_t readco(char *); |
| @@ -187,9 +406,9 @@ readcube(format_t format, char *buf) | |||
| 187 | ret = readcube_H48(buf); | 406 | ret = readcube_H48(buf); |
| 188 | break; | 407 | break; |
| 189 | default: | 408 | default: |
| 190 | #ifdef DEBUG | 409 | #ifdef DEBUG |
| 191 | fprintf(stderr, "Cannot read cube in the given format\n"); | 410 | fprintf(stderr, "Cannot read cube in the given format\n"); |
| 192 | #endif | 411 | #endif |
| 193 | setzero(ret); | 412 | setzero(ret); |
| 194 | } | 413 | } |
| 195 | 414 | ||
| @@ -421,18 +640,6 @@ writetrans(trans_t t, char *buf) | |||
| 421 | buf[11] = '\0'; | 640 | buf[11] = '\0'; |
| 422 | } | 641 | } |
| 423 | 642 | ||
| 424 | move_t | ||
| 425 | inverse_move(move_t m) | ||
| 426 | { | ||
| 427 | return inverse_move_arr[m]; | ||
| 428 | } | ||
| 429 | |||
| 430 | trans_t | ||
| 431 | inverse_trans(trans_t t) | ||
| 432 | { | ||
| 433 | return inverse_trans_arr[t]; | ||
| 434 | } | ||
| 435 | |||
| 436 | static int | 643 | static int |
| 437 | permsign(uint8_t *a, int n) | 644 | permsign(uint8_t *a, int n) |
| 438 | { | 645 | { |
| @@ -617,11 +824,49 @@ move(cube_t c, move_t m) | |||
| 617 | } | 824 | } |
| 618 | #endif | 825 | #endif |
| 619 | 826 | ||
| 620 | #ifdef CUBE_AVX2 | 827 | switch (m) { |
| 621 | #include "_move_logic_avx2.c" | 828 | case U: |
| 622 | #else | 829 | return inline_move_U(c); |
| 623 | #include "_move_logic_arr.c" | 830 | case U2: |
| 831 | return inline_move_U2(c); | ||
| 832 | case U3: | ||
| 833 | return inline_move_U3(c); | ||
| 834 | case D: | ||
| 835 | return inline_move_D(c); | ||
| 836 | case D2: | ||
| 837 | return inline_move_D2(c); | ||
| 838 | case D3: | ||
| 839 | return inline_move_D3(c); | ||
| 840 | case R: | ||
| 841 | return inline_move_R(c); | ||
| 842 | case R2: | ||
| 843 | return inline_move_R2(c); | ||
| 844 | case R3: | ||
| 845 | return inline_move_R3(c); | ||
| 846 | case L: | ||
| 847 | return inline_move_L(c); | ||
| 848 | case L2: | ||
| 849 | return inline_move_L2(c); | ||
| 850 | case L3: | ||
| 851 | return inline_move_L3(c); | ||
| 852 | case F: | ||
| 853 | return inline_move_F(c); | ||
| 854 | case F2: | ||
| 855 | return inline_move_F2(c); | ||
| 856 | case F3: | ||
| 857 | return inline_move_F3(c); | ||
| 858 | case B: | ||
| 859 | return inline_move_B(c); | ||
| 860 | case B2: | ||
| 861 | return inline_move_B2(c); | ||
| 862 | case B3: | ||
| 863 | return inline_move_B3(c); | ||
| 864 | default: | ||
| 865 | #ifdef DEBUG | ||
| 866 | fprintf(stderr, "mover error, unknown move\n"); | ||
| 624 | #endif | 867 | #endif |
| 868 | goto move_error; | ||
| 869 | } | ||
| 625 | 870 | ||
| 626 | move_error: | 871 | move_error: |
| 627 | setzero(err); | 872 | setzero(err); |
| @@ -696,56 +941,123 @@ compose(cube_t c1, cube_t c2) | |||
| 696 | return ret; | 941 | return ret; |
| 697 | } | 942 | } |
| 698 | 943 | ||
| 699 | static cube_t | ||
| 700 | flipallcorners(cube_t c) | ||
| 701 | { | ||
| 702 | /* TODO: optimize for avx2, can be a couple of instructions */ | ||
| 703 | |||
| 704 | uint8_t i, piece, orien; | ||
| 705 | cube_t ret; | ||
| 706 | |||
| 707 | ret = c; | ||
| 708 | for (i = 0; i < 8; i++) { | ||
| 709 | piece = get_corner(c, i); | ||
| 710 | orien = ((piece << 1) | (piece >> 1)) & _cobits2; | ||
| 711 | set_corner(ret, i, (piece & _pbits) | orien); | ||
| 712 | } | ||
| 713 | |||
| 714 | return ret; | ||
| 715 | } | ||
| 716 | |||
| 717 | cube_t | 944 | cube_t |
| 718 | transform(cube_t c, trans_t t) | 945 | transform(cube_t c, trans_t t) |
| 719 | { | 946 | { |
| 720 | cube_t ret, solved; | 947 | cube_t ret; |
| 721 | 948 | ||
| 722 | #ifdef DEBUG | 949 | #ifdef DEBUG |
| 723 | setzero(ret); | ||
| 724 | if (!isconsistent(c)) { | 950 | if (!isconsistent(c)) { |
| 725 | fprintf(stderr, "transform error, inconsistent cube\n"); | 951 | fprintf(stderr, "transform error, inconsistent cube\n"); |
| 726 | return ret; | 952 | goto trans_error; |
| 727 | } | ||
| 728 | if (t >= 48) { | ||
| 729 | fprintf(stderr, "transform error, unknown transformation\n"); | ||
| 730 | return ret; | ||
| 731 | } | 953 | } |
| 732 | #endif | 954 | #endif |
| 733 | 955 | ||
| 734 | #ifdef CUBE_AVX2 | 956 | switch (t) { |
| 735 | #include "_trans_move_avx2.c" | 957 | case UFr: |
| 736 | #else | 958 | return inline_trans_UFr(c); |
| 737 | #include "_trans_move_arr.c" | 959 | case ULr: |
| 960 | return inline_trans_ULr(c); | ||
| 961 | case UBr: | ||
| 962 | return inline_trans_UBr(c); | ||
| 963 | case URr: | ||
| 964 | return inline_trans_URr(c); | ||
| 965 | case DFr: | ||
| 966 | return inline_trans_DFr(c); | ||
| 967 | case DLr: | ||
| 968 | return inline_trans_DLr(c); | ||
| 969 | case DBr: | ||
| 970 | return inline_trans_DBr(c); | ||
| 971 | case DRr: | ||
| 972 | return inline_trans_DRr(c); | ||
| 973 | case RUr: | ||
| 974 | return inline_trans_RUr(c); | ||
| 975 | case RFr: | ||
| 976 | return inline_trans_RFr(c); | ||
| 977 | case RDr: | ||
| 978 | return inline_trans_RDr(c); | ||
| 979 | case RBr: | ||
| 980 | return inline_trans_RBr(c); | ||
| 981 | case LUr: | ||
| 982 | return inline_trans_LUr(c); | ||
| 983 | case LFr: | ||
| 984 | return inline_trans_LFr(c); | ||
| 985 | case LDr: | ||
| 986 | return inline_trans_LDr(c); | ||
| 987 | case LBr: | ||
| 988 | return inline_trans_LBr(c); | ||
| 989 | case FUr: | ||
| 990 | return inline_trans_FUr(c); | ||
| 991 | case FRr: | ||
| 992 | return inline_trans_FRr(c); | ||
| 993 | case FDr: | ||
| 994 | return inline_trans_FDr(c); | ||
| 995 | case FLr: | ||
| 996 | return inline_trans_FLr(c); | ||
| 997 | case BUr: | ||
| 998 | return inline_trans_BUr(c); | ||
| 999 | case BRr: | ||
| 1000 | return inline_trans_BRr(c); | ||
| 1001 | case BDr: | ||
| 1002 | return inline_trans_BDr(c); | ||
| 1003 | case BLr: | ||
| 1004 | return inline_trans_BLr(c); | ||
| 1005 | case UFm: | ||
| 1006 | return inline_trans_UFm(c); | ||
| 1007 | case ULm: | ||
| 1008 | return inline_trans_ULm(c); | ||
| 1009 | case UBm: | ||
| 1010 | return inline_trans_UBm(c); | ||
| 1011 | case URm: | ||
| 1012 | return inline_trans_URm(c); | ||
| 1013 | case DFm: | ||
| 1014 | return inline_trans_DFm(c); | ||
| 1015 | case DLm: | ||
| 1016 | return inline_trans_DLm(c); | ||
| 1017 | case DBm: | ||
| 1018 | return inline_trans_DBm(c); | ||
| 1019 | case DRm: | ||
| 1020 | return inline_trans_DRm(c); | ||
| 1021 | case RUm: | ||
| 1022 | return inline_trans_RUm(c); | ||
| 1023 | case RFm: | ||
| 1024 | return inline_trans_RFm(c); | ||
| 1025 | case RDm: | ||
| 1026 | return inline_trans_RDm(c); | ||
| 1027 | case RBm: | ||
| 1028 | return inline_trans_RBm(c); | ||
| 1029 | case LUm: | ||
| 1030 | return inline_trans_LUm(c); | ||
| 1031 | case LFm: | ||
| 1032 | return inline_trans_LFm(c); | ||
| 1033 | case LDm: | ||
| 1034 | return inline_trans_LDm(c); | ||
| 1035 | case LBm: | ||
| 1036 | return inline_trans_LBm(c); | ||
| 1037 | case FUm: | ||
| 1038 | return inline_trans_FUm(c); | ||
| 1039 | case FRm: | ||
| 1040 | return inline_trans_FRm(c); | ||
| 1041 | case FDm: | ||
| 1042 | return inline_trans_FDm(c); | ||
| 1043 | case FLm: | ||
| 1044 | return inline_trans_FLm(c); | ||
| 1045 | case BUm: | ||
| 1046 | return inline_trans_BUm(c); | ||
| 1047 | case BRm: | ||
| 1048 | return inline_trans_BRm(c); | ||
| 1049 | case BDm: | ||
| 1050 | return inline_trans_BDm(c); | ||
| 1051 | case BLm: | ||
| 1052 | return inline_trans_BLm(c); | ||
| 1053 | default: | ||
| 1054 | #ifdef DEBUG | ||
| 1055 | fprintf(stderr, "transform error, unknown transformation\n"); | ||
| 738 | #endif | 1056 | #endif |
| 1057 | goto trans_error; | ||
| 1058 | } | ||
| 739 | 1059 | ||
| 740 | setsolved(solved); | 1060 | trans_error: |
| 741 | 1061 | setzero(ret); | |
| 742 | ret = compose(solved, trans_move_cube[t]); | ||
| 743 | ret = compose(ret, c); | ||
| 744 | ret = compose(ret, trans_move_cube_inverse[t]); | ||
| 745 | |||
| 746 | /* TODO: work out a better way to do this */ | ||
| 747 | if (t >= 24) | ||
| 748 | ret = flipallcorners(ret); | ||
| 749 | |||
| 750 | return ret; | 1062 | return ret; |
| 751 | } | 1063 | } |
| @@ -16,9 +16,6 @@ void writemoves(move_t *, int, char *); | |||
| 16 | trans_t readtrans(char *); | 16 | trans_t readtrans(char *); |
| 17 | void writetrans(trans_t, char *); | 17 | void writetrans(trans_t, char *); |
| 18 | 18 | ||
| 19 | move_t inverse_move(move_t); | ||
| 20 | trans_t inverse_trans(trans_t); | ||
| 21 | |||
| 22 | typedef enum {H48, SRC} format_t; | 19 | typedef enum {H48, SRC} format_t; |
| 23 | cube_t readcube(format_t, char *); /* Supports: H48 */ | 20 | cube_t readcube(format_t, char *); /* Supports: H48 */ |
| 24 | void writecube(format_t, cube_t, char *); /* Supports: H48, SRC */ | 21 | void writecube(format_t, cube_t, char *); /* Supports: H48, SRC */ |
