diff options
Diffstat (limited to 'src/cube_portable.h')
| -rw-r--r-- | src/cube_portable.h | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/cube_portable.h b/src/cube_portable.h index fcd1d55..125c300 100644 --- a/src/cube_portable.h +++ b/src/cube_portable.h | |||
| @@ -17,9 +17,12 @@ _static_inline int64_t coord_fast_co(cube_fast_t); | |||
| 17 | _static_inline int64_t coord_fast_csep(cube_fast_t); | 17 | _static_inline int64_t coord_fast_csep(cube_fast_t); |
| 18 | _static_inline int64_t coord_fast_cocsep(cube_fast_t); | 18 | _static_inline int64_t coord_fast_cocsep(cube_fast_t); |
| 19 | _static_inline int64_t coord_fast_eo(cube_fast_t); | 19 | _static_inline int64_t coord_fast_eo(cube_fast_t); |
| 20 | _static_inline void set_eo_fast(cube_fast_t *, int64_t eo); | ||
| 21 | _static_inline int64_t coord_fast_esep(cube_fast_t); | 20 | _static_inline int64_t coord_fast_esep(cube_fast_t); |
| 22 | 21 | ||
| 22 | _static_inline void copy_corners_fast(cube_fast_t *, cube_fast_t); | ||
| 23 | _static_inline void copy_edges_fast(cube_fast_t *, cube_fast_t); | ||
| 24 | _static_inline void set_eo_fast(cube_fast_t *, int64_t); | ||
| 25 | |||
| 23 | _static_inline cube_fast_t | 26 | _static_inline cube_fast_t |
| 24 | fastcube( | 27 | fastcube( |
| 25 | uint8_t c_ufr, | 28 | uint8_t c_ufr, |
| @@ -189,12 +192,6 @@ coord_fast_eo(cube_fast_t c) | |||
| 189 | return ret; | 192 | return ret; |
| 190 | } | 193 | } |
| 191 | 194 | ||
| 192 | _static_inline void | ||
| 193 | _set_eo_fast(cube_fast_t *cube, int64_t eo) | ||
| 194 | { | ||
| 195 | /* TODO */ | ||
| 196 | } | ||
| 197 | |||
| 198 | /* | 195 | /* |
| 199 | We encode the edge separation as a number from 0 to C(12,4)*C(8,4). | 196 | We encode the edge separation as a number from 0 to C(12,4)*C(8,4). |
| 200 | It can be seen as the composition of two "subset index" coordinates. | 197 | It can be seen as the composition of two "subset index" coordinates. |
| @@ -229,3 +226,28 @@ coord_fast_esep(cube_fast_t c) | |||
| 229 | 226 | ||
| 230 | return ret1 * 70 + ret2; | 227 | return ret1 * 70 + ret2; |
| 231 | } | 228 | } |
| 229 | |||
| 230 | _static_inline void | ||
| 231 | copy_corners_fast(cube_fast_t *dest, cube_fast_t src) | ||
| 232 | { | ||
| 233 | memcpy(&dest->corner, src.corner, sizeof(src.corner)); | ||
| 234 | } | ||
| 235 | |||
| 236 | _static_inline void | ||
| 237 | copy_edges_fast(cube_fast_t *dest, cube_fast_t src) | ||
| 238 | { | ||
| 239 | memcpy(&dest->edge, src.edge, sizeof(src.edge)); | ||
| 240 | } | ||
| 241 | |||
| 242 | _static_inline void | ||
| 243 | set_eo_fast(cube_fast_t *cube, int64_t eo) | ||
| 244 | { | ||
| 245 | int i, sum, flip; | ||
| 246 | |||
| 247 | for (sum = 0, i = 1; i < 12; i++, eo >>= 1) { | ||
| 248 | flip = eo % 2; | ||
| 249 | sum += flip; | ||
| 250 | cube->edge[i] = (cube->edge[i] & ~_eobit) | (_eobit * flip); | ||
| 251 | } | ||
| 252 | cube->edge[0] = (cube->edge[0] & ~_eobit) | (_eobit * (sum%2)); | ||
| 253 | } | ||
