diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-25 11:50:16 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-05-25 11:50:16 +0200 |
| commit | 43020af69d6932c7af0bc53b59c492775835a14e (patch) | |
| tree | bf6d07a6ff2b5f37734fb1d1311a7468ad5acce9 /src | |
| parent | 0ebba869512abc8e37e461e7587f686fe7c91c6c (diff) | |
| download | nissy-core-43020af69d6932c7af0bc53b59c492775835a14e.tar.gz nissy-core-43020af69d6932c7af0bc53b59c492775835a14e.zip | |
Small performance improvement in h48 coordinate / transform
Diffstat (limited to 'src')
| -rw-r--r-- | src/cube.c | 2 | ||||
| -rw-r--r-- | src/cube_avx2.h | 34 | ||||
| -rw-r--r-- | src/cube_portable.h | 52 | ||||
| -rw-r--r-- | src/cube_routines.h | 117 | ||||
| -rw-r--r-- | src/cube_transform.h | 336 | ||||
| -rw-r--r-- | src/solve_h48.h | 6 |
6 files changed, 422 insertions, 125 deletions
| @@ -30,10 +30,12 @@ | |||
| 30 | #elif defined(CUBE_NEON) | 30 | #elif defined(CUBE_NEON) |
| 31 | #include "cube_neon.h" | 31 | #include "cube_neon.h" |
| 32 | #else | 32 | #else |
| 33 | #include <stdlib.h> /* TODO: check if can be removed */ | ||
| 33 | #include "cube_portable.h" | 34 | #include "cube_portable.h" |
| 34 | #endif | 35 | #endif |
| 35 | 36 | ||
| 36 | #include "cube_routines.h" | 37 | #include "cube_routines.h" |
| 38 | #include "cube_transform.h" /* TODO: merge with cube_routines? */ | ||
| 37 | #include "moves.h" | 39 | #include "moves.h" |
| 38 | #include "solve_h48.h" | 40 | #include "solve_h48.h" |
| 39 | #include "solve_generic.h" | 41 | #include "solve_generic.h" |
diff --git a/src/cube_avx2.h b/src/cube_avx2.h index 934737c..ad4aadb 100644 --- a/src/cube_avx2.h +++ b/src/cube_avx2.h | |||
| @@ -17,6 +17,9 @@ _static cube_t fasttocube(cube_fast_t); | |||
| 17 | _static_inline bool equal_fast(cube_fast_t, cube_fast_t); | 17 | _static_inline bool equal_fast(cube_fast_t, cube_fast_t); |
| 18 | _static_inline bool issolved_fast(cube_fast_t); | 18 | _static_inline bool issolved_fast(cube_fast_t); |
| 19 | _static_inline cube_fast_t invertco_fast(cube_fast_t); | 19 | _static_inline cube_fast_t invertco_fast(cube_fast_t); |
| 20 | _static_inline cube_fast_t compose_epcpeo(cube_fast_t, cube_fast_t); | ||
| 21 | _static_inline cube_fast_t compose_fast_edges(cube_fast_t, cube_fast_t); | ||
| 22 | _static_inline cube_fast_t compose_fast_corners(cube_fast_t, cube_fast_t); | ||
| 20 | _static_inline cube_fast_t compose_fast(cube_fast_t, cube_fast_t); | 23 | _static_inline cube_fast_t compose_fast(cube_fast_t, cube_fast_t); |
| 21 | 24 | ||
| 22 | _static_inline int64_t coord_fast_co(cube_fast_t); | 25 | _static_inline int64_t coord_fast_co(cube_fast_t); |
| @@ -123,9 +126,9 @@ invertco_fast(cube_fast_t c) | |||
| 123 | } | 126 | } |
| 124 | 127 | ||
| 125 | _static_inline cube_fast_t | 128 | _static_inline cube_fast_t |
| 126 | compose_fast(cube_fast_t c1, cube_fast_t c2) | 129 | compose_epcpeo(cube_fast_t c1, cube_fast_t c2) |
| 127 | { | 130 | { |
| 128 | cube_fast_t s, b, eo2, co1, co2, aux, auy1, auy2, auz1, auz2; | 131 | cube_fast_t b, s, eo2; |
| 129 | 132 | ||
| 130 | /* Permute and clean unused bits */ | 133 | /* Permute and clean unused bits */ |
| 131 | s = _mm256_shuffle_epi8(c1, c2); | 134 | s = _mm256_shuffle_epi8(c1, c2); |
| @@ -139,6 +142,33 @@ compose_fast(cube_fast_t c1, cube_fast_t c2) | |||
| 139 | eo2 = _mm256_and_si256(c2, _eo_avx2); | 142 | eo2 = _mm256_and_si256(c2, _eo_avx2); |
| 140 | s = _mm256_xor_si256(s, eo2); | 143 | s = _mm256_xor_si256(s, eo2); |
| 141 | 144 | ||
| 145 | return s; | ||
| 146 | } | ||
| 147 | |||
| 148 | _static_inline cube_fast_t | ||
| 149 | compose_fast_edges(cube_fast_t c1, cube_fast_t c2) | ||
| 150 | { | ||
| 151 | return compose_epcpeo(c1, c2); | ||
| 152 | } | ||
| 153 | |||
| 154 | _static_inline cube_fast_t | ||
| 155 | compose_fast_corners(cube_fast_t c1, cube_fast_t c2) | ||
| 156 | { | ||
| 157 | /* | ||
| 158 | * We do a full compose. Minor optimizations are possible, like | ||
| 159 | * saving one instruction by not doing EO, but it should not | ||
| 160 | * be significant. | ||
| 161 | */ | ||
| 162 | return compose_fast(c1, c2); | ||
| 163 | } | ||
| 164 | |||
| 165 | _static_inline cube_fast_t | ||
| 166 | compose_fast(cube_fast_t c1, cube_fast_t c2) | ||
| 167 | { | ||
| 168 | cube_fast_t s, co1, co2, aux, auy1, auy2, auz1, auz2; | ||
| 169 | |||
| 170 | s = compose_epcpeo(c1, c2); | ||
| 171 | |||
| 142 | /* Change CO */ | 172 | /* Change CO */ |
| 143 | co1 = _mm256_and_si256(s, _co2_avx2); | 173 | co1 = _mm256_and_si256(s, _co2_avx2); |
| 144 | co2 = _mm256_and_si256(c2, _co2_avx2); | 174 | co2 = _mm256_and_si256(c2, _co2_avx2); |
diff --git a/src/cube_portable.h b/src/cube_portable.h index e72c169..d62661a 100644 --- a/src/cube_portable.h +++ b/src/cube_portable.h | |||
| @@ -11,6 +11,10 @@ _static cube_t fasttocube(cube_fast_t); | |||
| 11 | _static_inline bool equal_fast(cube_fast_t, cube_fast_t); | 11 | _static_inline bool equal_fast(cube_fast_t, cube_fast_t); |
| 12 | _static_inline bool issolved_fast(cube_fast_t); | 12 | _static_inline bool issolved_fast(cube_fast_t); |
| 13 | _static_inline cube_fast_t invertco_fast(cube_fast_t); | 13 | _static_inline cube_fast_t invertco_fast(cube_fast_t); |
| 14 | _static_inline void compose_edges_inplace(cube_fast_t, cube_fast_t, cube_fast_t *); | ||
| 15 | _static_inline void compose_corners_inplace(cube_fast_t, cube_fast_t, cube_fast_t *); | ||
| 16 | _static_inline cube_fast_t compose_fast_edges(cube_fast_t, cube_fast_t); | ||
| 17 | _static_inline cube_fast_t compose_fast_corners(cube_fast_t, cube_fast_t); | ||
| 14 | _static_inline cube_fast_t compose_fast(cube_fast_t, cube_fast_t); | 18 | _static_inline cube_fast_t compose_fast(cube_fast_t, cube_fast_t); |
| 15 | 19 | ||
| 16 | _static_inline int64_t coord_fast_co(cube_fast_t); | 20 | _static_inline int64_t coord_fast_co(cube_fast_t); |
| @@ -115,21 +119,24 @@ invertco_fast(cube_fast_t c) | |||
| 115 | return ret; | 119 | return ret; |
| 116 | } | 120 | } |
| 117 | 121 | ||
| 118 | _static_inline cube_fast_t | 122 | _static_inline void |
| 119 | compose_fast(cube_fast_t c1, cube_fast_t c2) | 123 | compose_edges_inplace(cube_fast_t c1, cube_fast_t c2, cube_fast_t *ret) |
| 120 | { | 124 | { |
| 121 | cube_fast_t ret; | 125 | uint8_t i, piece1, piece2, p, orien; |
| 122 | uint8_t i, piece1, piece2, p, orien, aux, auy; | ||
| 123 | |||
| 124 | ret = zero_fast; | ||
| 125 | 126 | ||
| 126 | for (i = 0; i < 12; i++) { | 127 | for (i = 0; i < 12; i++) { |
| 127 | piece2 = c2.edge[i]; | 128 | piece2 = c2.edge[i]; |
| 128 | p = piece2 & _pbits; | 129 | p = piece2 & _pbits; |
| 129 | piece1 = c1.edge[p]; | 130 | piece1 = c1.edge[p]; |
| 130 | orien = (piece2 ^ piece1) & _eobit; | 131 | orien = (piece2 ^ piece1) & _eobit; |
| 131 | ret.edge[i] = (piece1 & _pbits) | orien; | 132 | ret->edge[i] = (piece1 & _pbits) | orien; |
| 132 | } | 133 | } |
| 134 | } | ||
| 135 | |||
| 136 | _static_inline void | ||
| 137 | compose_corners_inplace(cube_fast_t c1, cube_fast_t c2, cube_fast_t *ret) | ||
| 138 | { | ||
| 139 | uint8_t i, piece1, piece2, p, orien, aux, auy; | ||
| 133 | 140 | ||
| 134 | for (i = 0; i < 8; i++) { | 141 | for (i = 0; i < 8; i++) { |
| 135 | piece2 = c2.corner[i]; | 142 | piece2 = c2.corner[i]; |
| @@ -138,8 +145,37 @@ compose_fast(cube_fast_t c1, cube_fast_t c2) | |||
| 138 | aux = (piece2 & _cobits) + (piece1 & _cobits); | 145 | aux = (piece2 & _cobits) + (piece1 & _cobits); |
| 139 | auy = (aux + _ctwist_cw) >> 2U; | 146 | auy = (aux + _ctwist_cw) >> 2U; |
| 140 | orien = (aux + auy) & _cobits2; | 147 | orien = (aux + auy) & _cobits2; |
| 141 | ret.corner[i] = (piece1 & _pbits) | orien; | 148 | ret->corner[i] = (piece1 & _pbits) | orien; |
| 142 | } | 149 | } |
| 150 | } | ||
| 151 | |||
| 152 | _static_inline cube_fast_t | ||
| 153 | compose_fast_edges(cube_fast_t c1, cube_fast_t c2) | ||
| 154 | { | ||
| 155 | cube_fast_t ret = zero_fast; | ||
| 156 | |||
| 157 | compose_edges_inplace(c1, c2, &ret); | ||
| 158 | |||
| 159 | return ret; | ||
| 160 | } | ||
| 161 | |||
| 162 | _static_inline cube_fast_t | ||
| 163 | compose_fast_corners(cube_fast_t c1, cube_fast_t c2) | ||
| 164 | { | ||
| 165 | cube_fast_t ret = zero_fast; | ||
| 166 | |||
| 167 | compose_corners_inplace(c1, c2, &ret); | ||
| 168 | |||
| 169 | return ret; | ||
| 170 | } | ||
| 171 | |||
| 172 | _static_inline cube_fast_t | ||
| 173 | compose_fast(cube_fast_t c1, cube_fast_t c2) | ||
| 174 | { | ||
| 175 | cube_fast_t ret = zero_fast; | ||
| 176 | |||
| 177 | compose_edges_inplace(c1, c2, &ret); | ||
| 178 | compose_corners_inplace(c1, c2, &ret); | ||
| 143 | 179 | ||
| 144 | return ret; | 180 | return ret; |
| 145 | } | 181 | } |
diff --git a/src/cube_routines.h b/src/cube_routines.h index b1f8eac..1585e67 100644 --- a/src/cube_routines.h +++ b/src/cube_routines.h | |||
| @@ -1,11 +1,5 @@ | |||
| 1 | #define _move(M, c) compose_fast(c, _move_cube_ ## M) | 1 | #define _move(M, c) compose_fast(c, _move_cube_ ## M) |
| 2 | #define _premove(M, c) compose_fast(_move_cube_ ## M, c) | 2 | #define _premove(M, c) compose_fast(_move_cube_ ## M, c) |
| 3 | #define _trans_rotation(T, c) \ | ||
| 4 | compose_fast(compose_fast(_trans_cube_ ## T, c), \ | ||
| 5 | _trans_cube_ ## T ## _inverse) | ||
| 6 | #define _trans_mirrored(T, c) \ | ||
| 7 | invertco_fast(compose_fast(compose_fast(_trans_cube_ ## T, c), \ | ||
| 8 | _trans_cube_ ## T ## _inverse)) | ||
| 9 | 3 | ||
| 10 | _static int permsign(uint8_t *, int); | 4 | _static int permsign(uint8_t *, int); |
| 11 | _static uint8_t readco(const char *); | 5 | _static uint8_t readco(const char *); |
| @@ -24,6 +18,8 @@ _static uint8_t readtrans(const char *); | |||
| 24 | _static int writemoves(uint8_t *, int, char *); | 18 | _static int writemoves(uint8_t *, int, char *); |
| 25 | _static void writetrans(uint8_t, char *); | 19 | _static void writetrans(uint8_t, char *); |
| 26 | _static cube_fast_t move(cube_fast_t, uint8_t); | 20 | _static cube_fast_t move(cube_fast_t, uint8_t); |
| 21 | _static cube_fast_t transform_edges(cube_fast_t, uint8_t); | ||
| 22 | _static cube_fast_t transform_corners(cube_fast_t, uint8_t); | ||
| 27 | _static cube_fast_t transform(cube_fast_t, uint8_t); | 23 | _static cube_fast_t transform(cube_fast_t, uint8_t); |
| 28 | 24 | ||
| 29 | cube_t | 25 | cube_t |
| @@ -623,108 +619,7 @@ move(cube_fast_t c, uint8_t m) | |||
| 623 | } | 619 | } |
| 624 | } | 620 | } |
| 625 | 621 | ||
| 626 | _static cube_fast_t | 622 | /* |
| 627 | transform(cube_fast_t c, uint8_t t) | 623 | TODO transform is now relegated to a separated file because it is too long. |
| 628 | { | 624 | It would be nice to make it shorter without loosing performance. |
| 629 | switch (t) { | 625 | */ |
| 630 | case _trans_UFr: | ||
| 631 | return _trans_rotation(UFr, c); | ||
| 632 | case _trans_ULr: | ||
| 633 | return _trans_rotation(ULr, c); | ||
| 634 | case _trans_UBr: | ||
| 635 | return _trans_rotation(UBr, c); | ||
| 636 | case _trans_URr: | ||
| 637 | return _trans_rotation(URr, c); | ||
| 638 | case _trans_DFr: | ||
| 639 | return _trans_rotation(DFr, c); | ||
| 640 | case _trans_DLr: | ||
| 641 | return _trans_rotation(DLr, c); | ||
| 642 | case _trans_DBr: | ||
| 643 | return _trans_rotation(DBr, c); | ||
| 644 | case _trans_DRr: | ||
| 645 | return _trans_rotation(DRr, c); | ||
| 646 | case _trans_RUr: | ||
| 647 | return _trans_rotation(RUr, c); | ||
| 648 | case _trans_RFr: | ||
| 649 | return _trans_rotation(RFr, c); | ||
| 650 | case _trans_RDr: | ||
| 651 | return _trans_rotation(RDr, c); | ||
| 652 | case _trans_RBr: | ||
| 653 | return _trans_rotation(RBr, c); | ||
| 654 | case _trans_LUr: | ||
| 655 | return _trans_rotation(LUr, c); | ||
| 656 | case _trans_LFr: | ||
| 657 | return _trans_rotation(LFr, c); | ||
| 658 | case _trans_LDr: | ||
| 659 | return _trans_rotation(LDr, c); | ||
| 660 | case _trans_LBr: | ||
| 661 | return _trans_rotation(LBr, c); | ||
| 662 | case _trans_FUr: | ||
| 663 | return _trans_rotation(FUr, c); | ||
| 664 | case _trans_FRr: | ||
| 665 | return _trans_rotation(FRr, c); | ||
| 666 | case _trans_FDr: | ||
| 667 | return _trans_rotation(FDr, c); | ||
| 668 | case _trans_FLr: | ||
| 669 | return _trans_rotation(FLr, c); | ||
| 670 | case _trans_BUr: | ||
| 671 | return _trans_rotation(BUr, c); | ||
| 672 | case _trans_BRr: | ||
| 673 | return _trans_rotation(BRr, c); | ||
| 674 | case _trans_BDr: | ||
| 675 | return _trans_rotation(BDr, c); | ||
| 676 | case _trans_BLr: | ||
| 677 | return _trans_rotation(BLr, c); | ||
| 678 | case _trans_UFm: | ||
| 679 | return _trans_mirrored(UFm, c); | ||
| 680 | case _trans_ULm: | ||
| 681 | return _trans_mirrored(ULm, c); | ||
| 682 | case _trans_UBm: | ||
| 683 | return _trans_mirrored(UBm, c); | ||
| 684 | case _trans_URm: | ||
| 685 | return _trans_mirrored(URm, c); | ||
| 686 | case _trans_DFm: | ||
| 687 | return _trans_mirrored(DFm, c); | ||
| 688 | case _trans_DLm: | ||
| 689 | return _trans_mirrored(DLm, c); | ||
| 690 | case _trans_DBm: | ||
| 691 | return _trans_mirrored(DBm, c); | ||
| 692 | case _trans_DRm: | ||
| 693 | return _trans_mirrored(DRm, c); | ||
| 694 | case _trans_RUm: | ||
| 695 | return _trans_mirrored(RUm, c); | ||
| 696 | case _trans_RFm: | ||
| 697 | return _trans_mirrored(RFm, c); | ||
| 698 | case _trans_RDm: | ||
| 699 | return _trans_mirrored(RDm, c); | ||
| 700 | case _trans_RBm: | ||
| 701 | return _trans_mirrored(RBm, c); | ||
| 702 | case _trans_LUm: | ||
| 703 | return _trans_mirrored(LUm, c); | ||
| 704 | case _trans_LFm: | ||
| 705 | return _trans_mirrored(LFm, c); | ||
| 706 | case _trans_LDm: | ||
| 707 | return _trans_mirrored(LDm, c); | ||
| 708 | case _trans_LBm: | ||
| 709 | return _trans_mirrored(LBm, c); | ||
| 710 | case _trans_FUm: | ||
| 711 | return _trans_mirrored(FUm, c); | ||
| 712 | case _trans_FRm: | ||
| 713 | return _trans_mirrored(FRm, c); | ||
| 714 | case _trans_FDm: | ||
| 715 | return _trans_mirrored(FDm, c); | ||
| 716 | case _trans_FLm: | ||
| 717 | return _trans_mirrored(FLm, c); | ||
| 718 | case _trans_BUm: | ||
| 719 | return _trans_mirrored(BUm, c); | ||
| 720 | case _trans_BRm: | ||
| 721 | return _trans_mirrored(BRm, c); | ||
| 722 | case _trans_BDm: | ||
| 723 | return _trans_mirrored(BDm, c); | ||
| 724 | case _trans_BLm: | ||
| 725 | return _trans_mirrored(BLm, c); | ||
| 726 | default: | ||
| 727 | DBG_LOG("transform error, unknown transformation\n"); | ||
| 728 | return zero_fast; | ||
| 729 | } | ||
| 730 | } | ||
diff --git a/src/cube_transform.h b/src/cube_transform.h new file mode 100644 index 0000000..d9a0941 --- /dev/null +++ b/src/cube_transform.h | |||
| @@ -0,0 +1,336 @@ | |||
| 1 | #define _trans_edges_rotation(T, c) \ | ||
| 2 | compose_fast_edges(compose_fast_edges(_trans_cube_ ## T, c), \ | ||
| 3 | _trans_cube_ ## T ## _inverse) | ||
| 4 | #define _trans_edges_mirrored(T, c) _trans_edges_rotation(T, c) | ||
| 5 | |||
| 6 | #define _trans_corners_rotation(T, c) \ | ||
| 7 | compose_fast_corners(compose_fast_corners(_trans_cube_ ## T, c), \ | ||
| 8 | _trans_cube_ ## T ## _inverse) | ||
| 9 | #define _trans_corners_mirrored(T, c) \ | ||
| 10 | invertco_fast(compose_fast_corners( \ | ||
| 11 | compose_fast_corners(_trans_cube_ ## T, c), _trans_cube_ ## T ## _inverse)) | ||
| 12 | |||
| 13 | #define _trans_rotation(T, c) \ | ||
| 14 | compose_fast(compose_fast(_trans_cube_ ## T, c), \ | ||
| 15 | _trans_cube_ ## T ## _inverse) | ||
| 16 | #define _trans_mirrored(T, c) \ | ||
| 17 | invertco_fast(compose_fast(compose_fast(_trans_cube_ ## T, c), \ | ||
| 18 | _trans_cube_ ## T ## _inverse)) | ||
| 19 | |||
| 20 | _static cube_fast_t | ||
| 21 | transform_edges(cube_fast_t c, uint8_t t) | ||
| 22 | { | ||
| 23 | switch (t) { | ||
| 24 | case _trans_UFr: | ||
| 25 | return _trans_edges_rotation(UFr, c); | ||
| 26 | case _trans_ULr: | ||
| 27 | return _trans_edges_rotation(ULr, c); | ||
| 28 | case _trans_UBr: | ||
| 29 | return _trans_edges_rotation(UBr, c); | ||
| 30 | case _trans_URr: | ||
| 31 | return _trans_edges_rotation(URr, c); | ||
| 32 | case _trans_DFr: | ||
| 33 | return _trans_edges_rotation(DFr, c); | ||
| 34 | case _trans_DLr: | ||
| 35 | return _trans_edges_rotation(DLr, c); | ||
| 36 | case _trans_DBr: | ||
| 37 | return _trans_edges_rotation(DBr, c); | ||
| 38 | case _trans_DRr: | ||
| 39 | return _trans_edges_rotation(DRr, c); | ||
| 40 | case _trans_RUr: | ||
| 41 | return _trans_edges_rotation(RUr, c); | ||
| 42 | case _trans_RFr: | ||
| 43 | return _trans_edges_rotation(RFr, c); | ||
| 44 | case _trans_RDr: | ||
| 45 | return _trans_edges_rotation(RDr, c); | ||
| 46 | case _trans_RBr: | ||
| 47 | return _trans_edges_rotation(RBr, c); | ||
| 48 | case _trans_LUr: | ||
| 49 | return _trans_edges_rotation(LUr, c); | ||
| 50 | case _trans_LFr: | ||
| 51 | return _trans_edges_rotation(LFr, c); | ||
| 52 | case _trans_LDr: | ||
| 53 | return _trans_edges_rotation(LDr, c); | ||
| 54 | case _trans_LBr: | ||
| 55 | return _trans_edges_rotation(LBr, c); | ||
| 56 | case _trans_FUr: | ||
| 57 | return _trans_edges_rotation(FUr, c); | ||
| 58 | case _trans_FRr: | ||
| 59 | return _trans_edges_rotation(FRr, c); | ||
| 60 | case _trans_FDr: | ||
| 61 | return _trans_edges_rotation(FDr, c); | ||
| 62 | case _trans_FLr: | ||
| 63 | return _trans_edges_rotation(FLr, c); | ||
| 64 | case _trans_BUr: | ||
| 65 | return _trans_edges_rotation(BUr, c); | ||
| 66 | case _trans_BRr: | ||
| 67 | return _trans_edges_rotation(BRr, c); | ||
| 68 | case _trans_BDr: | ||
| 69 | return _trans_edges_rotation(BDr, c); | ||
| 70 | case _trans_BLr: | ||
| 71 | return _trans_edges_rotation(BLr, c); | ||
| 72 | case _trans_UFm: | ||
| 73 | return _trans_edges_mirrored(UFm, c); | ||
| 74 | case _trans_ULm: | ||
| 75 | return _trans_edges_mirrored(ULm, c); | ||
| 76 | case _trans_UBm: | ||
| 77 | return _trans_edges_mirrored(UBm, c); | ||
| 78 | case _trans_URm: | ||
| 79 | return _trans_edges_mirrored(URm, c); | ||
| 80 | case _trans_DFm: | ||
| 81 | return _trans_edges_mirrored(DFm, c); | ||
| 82 | case _trans_DLm: | ||
| 83 | return _trans_edges_mirrored(DLm, c); | ||
| 84 | case _trans_DBm: | ||
| 85 | return _trans_edges_mirrored(DBm, c); | ||
| 86 | case _trans_DRm: | ||
| 87 | return _trans_edges_mirrored(DRm, c); | ||
| 88 | case _trans_RUm: | ||
| 89 | return _trans_edges_mirrored(RUm, c); | ||
| 90 | case _trans_RFm: | ||
| 91 | return _trans_edges_mirrored(RFm, c); | ||
| 92 | case _trans_RDm: | ||
| 93 | return _trans_edges_mirrored(RDm, c); | ||
| 94 | case _trans_RBm: | ||
| 95 | return _trans_edges_mirrored(RBm, c); | ||
| 96 | case _trans_LUm: | ||
| 97 | return _trans_edges_mirrored(LUm, c); | ||
| 98 | case _trans_LFm: | ||
| 99 | return _trans_edges_mirrored(LFm, c); | ||
| 100 | case _trans_LDm: | ||
| 101 | return _trans_edges_mirrored(LDm, c); | ||
| 102 | case _trans_LBm: | ||
| 103 | return _trans_edges_mirrored(LBm, c); | ||
| 104 | case _trans_FUm: | ||
| 105 | return _trans_edges_mirrored(FUm, c); | ||
| 106 | case _trans_FRm: | ||
| 107 | return _trans_edges_mirrored(FRm, c); | ||
| 108 | case _trans_FDm: | ||
| 109 | return _trans_edges_mirrored(FDm, c); | ||
| 110 | case _trans_FLm: | ||
| 111 | return _trans_edges_mirrored(FLm, c); | ||
| 112 | case _trans_BUm: | ||
| 113 | return _trans_edges_mirrored(BUm, c); | ||
| 114 | case _trans_BRm: | ||
| 115 | return _trans_edges_mirrored(BRm, c); | ||
| 116 | case _trans_BDm: | ||
| 117 | return _trans_edges_mirrored(BDm, c); | ||
| 118 | case _trans_BLm: | ||
| 119 | return _trans_edges_mirrored(BLm, c); | ||
| 120 | default: | ||
| 121 | DBG_LOG("transform error, unknown transformation\n"); | ||
| 122 | return zero_fast; | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | _static cube_fast_t | ||
| 127 | transform_corners(cube_fast_t c, uint8_t t) | ||
| 128 | { | ||
| 129 | switch (t) { | ||
| 130 | case _trans_UFr: | ||
| 131 | return _trans_corners_rotation(UFr, c); | ||
| 132 | case _trans_ULr: | ||
| 133 | return _trans_corners_rotation(ULr, c); | ||
| 134 | case _trans_UBr: | ||
| 135 | return _trans_corners_rotation(UBr, c); | ||
| 136 | case _trans_URr: | ||
| 137 | return _trans_corners_rotation(URr, c); | ||
| 138 | case _trans_DFr: | ||
| 139 | return _trans_corners_rotation(DFr, c); | ||
| 140 | case _trans_DLr: | ||
| 141 | return _trans_corners_rotation(DLr, c); | ||
| 142 | case _trans_DBr: | ||
| 143 | return _trans_corners_rotation(DBr, c); | ||
| 144 | case _trans_DRr: | ||
| 145 | return _trans_corners_rotation(DRr, c); | ||
| 146 | case _trans_RUr: | ||
| 147 | return _trans_corners_rotation(RUr, c); | ||
| 148 | case _trans_RFr: | ||
| 149 | return _trans_corners_rotation(RFr, c); | ||
| 150 | case _trans_RDr: | ||
| 151 | return _trans_corners_rotation(RDr, c); | ||
| 152 | case _trans_RBr: | ||
| 153 | return _trans_corners_rotation(RBr, c); | ||
| 154 | case _trans_LUr: | ||
| 155 | return _trans_corners_rotation(LUr, c); | ||
| 156 | case _trans_LFr: | ||
| 157 | return _trans_corners_rotation(LFr, c); | ||
| 158 | case _trans_LDr: | ||
| 159 | return _trans_corners_rotation(LDr, c); | ||
| 160 | case _trans_LBr: | ||
| 161 | return _trans_corners_rotation(LBr, c); | ||
| 162 | case _trans_FUr: | ||
| 163 | return _trans_corners_rotation(FUr, c); | ||
| 164 | case _trans_FRr: | ||
| 165 | return _trans_corners_rotation(FRr, c); | ||
| 166 | case _trans_FDr: | ||
| 167 | return _trans_corners_rotation(FDr, c); | ||
| 168 | case _trans_FLr: | ||
| 169 | return _trans_corners_rotation(FLr, c); | ||
| 170 | case _trans_BUr: | ||
| 171 | return _trans_corners_rotation(BUr, c); | ||
| 172 | case _trans_BRr: | ||
| 173 | return _trans_corners_rotation(BRr, c); | ||
| 174 | case _trans_BDr: | ||
| 175 | return _trans_corners_rotation(BDr, c); | ||
| 176 | case _trans_BLr: | ||
| 177 | return _trans_corners_rotation(BLr, c); | ||
| 178 | case _trans_UFm: | ||
| 179 | return _trans_corners_mirrored(UFm, c); | ||
| 180 | case _trans_ULm: | ||
| 181 | return _trans_corners_mirrored(ULm, c); | ||
| 182 | case _trans_UBm: | ||
| 183 | return _trans_corners_mirrored(UBm, c); | ||
| 184 | case _trans_URm: | ||
| 185 | return _trans_corners_mirrored(URm, c); | ||
| 186 | case _trans_DFm: | ||
| 187 | return _trans_corners_mirrored(DFm, c); | ||
| 188 | case _trans_DLm: | ||
| 189 | return _trans_corners_mirrored(DLm, c); | ||
| 190 | case _trans_DBm: | ||
| 191 | return _trans_corners_mirrored(DBm, c); | ||
| 192 | case _trans_DRm: | ||
| 193 | return _trans_corners_mirrored(DRm, c); | ||
| 194 | case _trans_RUm: | ||
| 195 | return _trans_corners_mirrored(RUm, c); | ||
| 196 | case _trans_RFm: | ||
| 197 | return _trans_corners_mirrored(RFm, c); | ||
| 198 | case _trans_RDm: | ||
| 199 | return _trans_corners_mirrored(RDm, c); | ||
| 200 | case _trans_RBm: | ||
| 201 | return _trans_corners_mirrored(RBm, c); | ||
| 202 | case _trans_LUm: | ||
| 203 | return _trans_corners_mirrored(LUm, c); | ||
| 204 | case _trans_LFm: | ||
| 205 | return _trans_corners_mirrored(LFm, c); | ||
| 206 | case _trans_LDm: | ||
| 207 | return _trans_corners_mirrored(LDm, c); | ||
| 208 | case _trans_LBm: | ||
| 209 | return _trans_corners_mirrored(LBm, c); | ||
| 210 | case _trans_FUm: | ||
| 211 | return _trans_corners_mirrored(FUm, c); | ||
| 212 | case _trans_FRm: | ||
| 213 | return _trans_corners_mirrored(FRm, c); | ||
| 214 | case _trans_FDm: | ||
| 215 | return _trans_corners_mirrored(FDm, c); | ||
| 216 | case _trans_FLm: | ||
| 217 | return _trans_corners_mirrored(FLm, c); | ||
| 218 | case _trans_BUm: | ||
| 219 | return _trans_corners_mirrored(BUm, c); | ||
| 220 | case _trans_BRm: | ||
| 221 | return _trans_corners_mirrored(BRm, c); | ||
| 222 | case _trans_BDm: | ||
| 223 | return _trans_corners_mirrored(BDm, c); | ||
| 224 | case _trans_BLm: | ||
| 225 | return _trans_corners_mirrored(BLm, c); | ||
| 226 | default: | ||
| 227 | DBG_LOG("transform error, unknown transformation\n"); | ||
| 228 | return zero_fast; | ||
| 229 | } | ||
| 230 | } | ||
| 231 | |||
| 232 | _static cube_fast_t | ||
| 233 | transform(cube_fast_t c, uint8_t t) | ||
| 234 | { | ||
| 235 | switch (t) { | ||
| 236 | case _trans_UFr: | ||
| 237 | return _trans_rotation(UFr, c); | ||
| 238 | case _trans_ULr: | ||
| 239 | return _trans_rotation(ULr, c); | ||
| 240 | case _trans_UBr: | ||
| 241 | return _trans_rotation(UBr, c); | ||
| 242 | case _trans_URr: | ||
| 243 | return _trans_rotation(URr, c); | ||
| 244 | case _trans_DFr: | ||
| 245 | return _trans_rotation(DFr, c); | ||
| 246 | case _trans_DLr: | ||
| 247 | return _trans_rotation(DLr, c); | ||
| 248 | case _trans_DBr: | ||
| 249 | return _trans_rotation(DBr, c); | ||
| 250 | case _trans_DRr: | ||
| 251 | return _trans_rotation(DRr, c); | ||
| 252 | case _trans_RUr: | ||
| 253 | return _trans_rotation(RUr, c); | ||
| 254 | case _trans_RFr: | ||
| 255 | return _trans_rotation(RFr, c); | ||
| 256 | case _trans_RDr: | ||
| 257 | return _trans_rotation(RDr, c); | ||
| 258 | case _trans_RBr: | ||
| 259 | return _trans_rotation(RBr, c); | ||
| 260 | case _trans_LUr: | ||
| 261 | return _trans_rotation(LUr, c); | ||
| 262 | case _trans_LFr: | ||
| 263 | return _trans_rotation(LFr, c); | ||
| 264 | case _trans_LDr: | ||
| 265 | return _trans_rotation(LDr, c); | ||
| 266 | case _trans_LBr: | ||
| 267 | return _trans_rotation(LBr, c); | ||
| 268 | case _trans_FUr: | ||
| 269 | return _trans_rotation(FUr, c); | ||
| 270 | case _trans_FRr: | ||
| 271 | return _trans_rotation(FRr, c); | ||
| 272 | case _trans_FDr: | ||
| 273 | return _trans_rotation(FDr, c); | ||
| 274 | case _trans_FLr: | ||
| 275 | return _trans_rotation(FLr, c); | ||
| 276 | case _trans_BUr: | ||
| 277 | return _trans_rotation(BUr, c); | ||
| 278 | case _trans_BRr: | ||
| 279 | return _trans_rotation(BRr, c); | ||
| 280 | case _trans_BDr: | ||
| 281 | return _trans_rotation(BDr, c); | ||
| 282 | case _trans_BLr: | ||
| 283 | return _trans_rotation(BLr, c); | ||
| 284 | case _trans_UFm: | ||
| 285 | return _trans_mirrored(UFm, c); | ||
| 286 | case _trans_ULm: | ||
| 287 | return _trans_mirrored(ULm, c); | ||
| 288 | case _trans_UBm: | ||
| 289 | return _trans_mirrored(UBm, c); | ||
| 290 | case _trans_URm: | ||
| 291 | return _trans_mirrored(URm, c); | ||
| 292 | case _trans_DFm: | ||
| 293 | return _trans_mirrored(DFm, c); | ||
| 294 | case _trans_DLm: | ||
| 295 | return _trans_mirrored(DLm, c); | ||
| 296 | case _trans_DBm: | ||
| 297 | return _trans_mirrored(DBm, c); | ||
| 298 | case _trans_DRm: | ||
| 299 | return _trans_mirrored(DRm, c); | ||
| 300 | case _trans_RUm: | ||
| 301 | return _trans_mirrored(RUm, c); | ||
| 302 | case _trans_RFm: | ||
| 303 | return _trans_mirrored(RFm, c); | ||
| 304 | case _trans_RDm: | ||
| 305 | return _trans_mirrored(RDm, c); | ||
| 306 | case _trans_RBm: | ||
| 307 | return _trans_mirrored(RBm, c); | ||
| 308 | case _trans_LUm: | ||
| 309 | return _trans_mirrored(LUm, c); | ||
| 310 | case _trans_LFm: | ||
| 311 | return _trans_mirrored(LFm, c); | ||
| 312 | case _trans_LDm: | ||
| 313 | return _trans_mirrored(LDm, c); | ||
| 314 | case _trans_LBm: | ||
| 315 | return _trans_mirrored(LBm, c); | ||
| 316 | case _trans_FUm: | ||
| 317 | return _trans_mirrored(FUm, c); | ||
| 318 | case _trans_FRm: | ||
| 319 | return _trans_mirrored(FRm, c); | ||
| 320 | case _trans_FDm: | ||
| 321 | return _trans_mirrored(FDm, c); | ||
| 322 | case _trans_FLm: | ||
| 323 | return _trans_mirrored(FLm, c); | ||
| 324 | case _trans_BUm: | ||
| 325 | return _trans_mirrored(BUm, c); | ||
| 326 | case _trans_BRm: | ||
| 327 | return _trans_mirrored(BRm, c); | ||
| 328 | case _trans_BDm: | ||
| 329 | return _trans_mirrored(BDm, c); | ||
| 330 | case _trans_BLm: | ||
| 331 | return _trans_mirrored(BLm, c); | ||
| 332 | default: | ||
| 333 | DBG_LOG("transform error, unknown transformation\n"); | ||
| 334 | return zero_fast; | ||
| 335 | } | ||
| 336 | } | ||
diff --git a/src/solve_h48.h b/src/solve_h48.h index 14c114a..d08fc72 100644 --- a/src/solve_h48.h +++ b/src/solve_h48.h | |||
| @@ -71,8 +71,7 @@ coord_h48_edges(cube_fast_t c, int64_t coclass, uint8_t t, uint8_t h) | |||
| 71 | cube_fast_t d; | 71 | cube_fast_t d; |
| 72 | int64_t esep, eo; | 72 | int64_t esep, eo; |
| 73 | 73 | ||
| 74 | //d = transform_edges(c, t); | 74 | d = transform_edges(c, t); |
| 75 | d = transform(c, t); | ||
| 76 | esep = coord_fast_esep(d); | 75 | esep = coord_fast_esep(d); |
| 77 | eo = coord_fast_eo(d); | 76 | eo = coord_fast_eo(d); |
| 78 | 77 | ||
| @@ -181,8 +180,7 @@ gendata_cocsep_dfs(dfsarg_cocsep_t *arg) | |||
| 181 | return 0; | 180 | return 0; |
| 182 | 181 | ||
| 183 | for (t = 0, cc = 0; t < 48; t++) { | 182 | for (t = 0, cc = 0; t < 48; t++) { |
| 184 | //d = transform_corners(arg->cube, t); | 183 | d = transform_corners(arg->cube, t); |
| 185 | d = transform(arg->cube, t); | ||
| 186 | ii = coord_fast_cocsep(d); | 184 | ii = coord_fast_cocsep(d); |
| 187 | arg->selfsim[*arg->n] |= (i == ii) << t; | 185 | arg->selfsim[*arg->n] |= (i == ii) << t; |
| 188 | set_visited(arg->visited, ii); | 186 | set_visited(arg->visited, ii); |
