diff options
Diffstat (limited to 'src/arch/portable.h')
| -rw-r--r-- | src/arch/portable.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/arch/portable.h b/src/arch/portable.h index bd67c18..ec992a8 100644 --- a/src/arch/portable.h +++ b/src/arch/portable.h | |||
| @@ -290,3 +290,47 @@ set_eo(cube_t cube[static 1], int64_t eo) | |||
| 290 | } | 290 | } |
| 291 | cube->edge[0] = (cube->edge[0] & ~EOBIT) | (EOBIT * (sum % 2)); | 291 | cube->edge[0] = (cube->edge[0] & ~EOBIT) | (EOBIT * (sum % 2)); |
| 292 | } | 292 | } |
| 293 | |||
| 294 | STATIC_INLINE int64_t | ||
| 295 | coord_cp(cube_t cube) | ||
| 296 | { | ||
| 297 | int i; | ||
| 298 | |||
| 299 | for (i = 0; i < 8; i++) | ||
| 300 | cube.corner[i] &= PBITS; | ||
| 301 | |||
| 302 | return permtoindex(8, cube.corner); | ||
| 303 | } | ||
| 304 | |||
| 305 | STATIC_INLINE cube_t | ||
| 306 | invcoord_cp(int64_t i) | ||
| 307 | { | ||
| 308 | uint8_t c[8]; | ||
| 309 | |||
| 310 | indextoperm(i, 8, c); | ||
| 311 | |||
| 312 | return STATIC_CUBE(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], | ||
| 313 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); | ||
| 314 | } | ||
| 315 | |||
| 316 | STATIC_INLINE int64_t | ||
| 317 | coord_epud(cube_t cube) | ||
| 318 | { | ||
| 319 | int i; | ||
| 320 | |||
| 321 | for (i = 0; i < 8; i++) | ||
| 322 | cube.edge[i] &= PBITS; | ||
| 323 | |||
| 324 | return permtoindex(8, cube.edge); | ||
| 325 | } | ||
| 326 | |||
| 327 | STATIC_INLINE cube_t | ||
| 328 | invcoord_epud(int64_t i) | ||
| 329 | { | ||
| 330 | uint8_t e[8]; | ||
| 331 | |||
| 332 | indextoperm(i, 8, e); | ||
| 333 | |||
| 334 | return STATIC_CUBE(0, 1, 2, 3, 4, 5, 6, 7, | ||
| 335 | e[0], e[1], e[2], e[3], e[4], e[5], e[6], e[7], 8, 9, 10, 11); | ||
| 336 | } | ||
