diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-04-01 10:22:25 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-04-01 10:22:25 +0200 |
| commit | 74e428a476cc539fbbe75e7cb790a0e7e4d3febb (patch) | |
| tree | c9f152191bded715081c2a8e839122e3a1ef853a | |
| parent | 2cff8fe8f8d18d0d6ed51d5a25b43b20ddf20901 (diff) | |
| download | nissy-core-74e428a476cc539fbbe75e7cb790a0e7e4d3febb.tar.gz nissy-core-74e428a476cc539fbbe75e7cb790a0e7e4d3febb.zip | |
Added unrolled loop over trans for experiments
Diffstat (limited to '')
| -rw-r--r-- | cube.c | 62 |
1 files changed, 57 insertions, 5 deletions
| @@ -1075,7 +1075,7 @@ previous sections, while some other operate directly on the cube. | |||
| 1075 | invertco_fast(compose_fast(compose_fast(_trans_cube_ ## T, c), \ | 1075 | invertco_fast(compose_fast(compose_fast(_trans_cube_ ## T, c), \ |
| 1076 | _trans_cube_ ## T ## _inverse)) | 1076 | _trans_cube_ ## T ## _inverse)) |
| 1077 | 1077 | ||
| 1078 | /* | 1078 | #ifdef MOVE_TRANS_LOOP_UNROLL |
| 1079 | #define _foreach_move(_m, _c, _d, instruction) \ | 1079 | #define _foreach_move(_m, _c, _d, instruction) \ |
| 1080 | _m = U; _d = _move(U, _c); instruction \ | 1080 | _m = U; _d = _move(U, _c); instruction \ |
| 1081 | _m = U2; _d = _move(U2, _c); instruction \ | 1081 | _m = U2; _d = _move(U2, _c); instruction \ |
| @@ -1095,9 +1095,61 @@ previous sections, while some other operate directly on the cube. | |||
| 1095 | _m = B; _d = _move(B, _c); instruction \ | 1095 | _m = B; _d = _move(B, _c); instruction \ |
| 1096 | _m = B2; _d = _move(B2, _c); instruction \ | 1096 | _m = B2; _d = _move(B2, _c); instruction \ |
| 1097 | _m = B3; _d = _move(B3, _c); instruction | 1097 | _m = B3; _d = _move(B3, _c); instruction |
| 1098 | */ | 1098 | #define _foreach_trans(_t, _c, _d, instruction) \ |
| 1099 | _t = UFr; _d = _trans_rotation(UFr, _c); instruction \ | ||
| 1100 | _t = ULr; _d = _trans_rotation(ULr, _c); instruction \ | ||
| 1101 | _t = UBr; _d = _trans_rotation(UBr, _c); instruction \ | ||
| 1102 | _t = URr; _d = _trans_rotation(URr, _c); instruction \ | ||
| 1103 | _t = DFr; _d = _trans_rotation(DFr, _c); instruction \ | ||
| 1104 | _t = DLr; _d = _trans_rotation(DLr, _c); instruction \ | ||
| 1105 | _t = DBr; _d = _trans_rotation(DBr, _c); instruction \ | ||
| 1106 | _t = DRr; _d = _trans_rotation(DRr, _c); instruction \ | ||
| 1107 | _t = RUr; _d = _trans_rotation(RUr, _c); instruction \ | ||
| 1108 | _t = RFr; _d = _trans_rotation(RFr, _c); instruction \ | ||
| 1109 | _t = RDr; _d = _trans_rotation(RDr, _c); instruction \ | ||
| 1110 | _t = RBr; _d = _trans_rotation(RBr, _c); instruction \ | ||
| 1111 | _t = LUr; _d = _trans_rotation(LUr, _c); instruction \ | ||
| 1112 | _t = LFr; _d = _trans_rotation(LFr, _c); instruction \ | ||
| 1113 | _t = LDr; _d = _trans_rotation(LDr, _c); instruction \ | ||
| 1114 | _t = LBr; _d = _trans_rotation(LBr, _c); instruction \ | ||
| 1115 | _t = FUr; _d = _trans_rotation(FUr, _c); instruction \ | ||
| 1116 | _t = FRr; _d = _trans_rotation(FRr, _c); instruction \ | ||
| 1117 | _t = FDr; _d = _trans_rotation(FDr, _c); instruction \ | ||
| 1118 | _t = FLr; _d = _trans_rotation(FLr, _c); instruction \ | ||
| 1119 | _t = BUr; _d = _trans_rotation(BUr, _c); instruction \ | ||
| 1120 | _t = BRr; _d = _trans_rotation(BRr, _c); instruction \ | ||
| 1121 | _t = BDr; _d = _trans_rotation(BDr, _c); instruction \ | ||
| 1122 | _t = BLr; _d = _trans_rotation(BLr, _c); instruction \ | ||
| 1123 | _t = UFm; _d = _trans_mirrored(UFm, _c); instruction \ | ||
| 1124 | _t = ULm; _d = _trans_mirrored(ULm, _c); instruction \ | ||
| 1125 | _t = UBm; _d = _trans_mirrored(UBm, _c); instruction \ | ||
| 1126 | _t = URm; _d = _trans_mirrored(URm, _c); instruction \ | ||
| 1127 | _t = DFm; _d = _trans_mirrored(DFm, _c); instruction \ | ||
| 1128 | _t = DLm; _d = _trans_mirrored(DLm, _c); instruction \ | ||
| 1129 | _t = DBm; _d = _trans_mirrored(DBm, _c); instruction \ | ||
| 1130 | _t = DRm; _d = _trans_mirrored(DRm, _c); instruction \ | ||
| 1131 | _t = RUm; _d = _trans_mirrored(RUm, _c); instruction \ | ||
| 1132 | _t = RFm; _d = _trans_mirrored(RFm, _c); instruction \ | ||
| 1133 | _t = RDm; _d = _trans_mirrored(RDm, _c); instruction \ | ||
| 1134 | _t = RBm; _d = _trans_mirrored(RBm, _c); instruction \ | ||
| 1135 | _t = LUm; _d = _trans_mirrored(LUm, _c); instruction \ | ||
| 1136 | _t = LFm; _d = _trans_mirrored(LFm, _c); instruction \ | ||
| 1137 | _t = LDm; _d = _trans_mirrored(LDm, _c); instruction \ | ||
| 1138 | _t = LBm; _d = _trans_mirrored(LBm, _c); instruction \ | ||
| 1139 | _t = FUm; _d = _trans_mirrored(FUm, _c); instruction \ | ||
| 1140 | _t = FRm; _d = _trans_mirrored(FRm, _c); instruction \ | ||
| 1141 | _t = FDm; _d = _trans_mirrored(FDm, _c); instruction \ | ||
| 1142 | _t = FLm; _d = _trans_mirrored(FLm, _c); instruction \ | ||
| 1143 | _t = BUm; _d = _trans_mirrored(BUm, _c); instruction \ | ||
| 1144 | _t = BRm; _d = _trans_mirrored(BRm, _c); instruction \ | ||
| 1145 | _t = BDm; _d = _trans_mirrored(BDm, _c); instruction \ | ||
| 1146 | _t = BLm; _d = _trans_mirrored(BLm, _c); instruction | ||
| 1147 | #else | ||
| 1099 | #define _foreach_move(_m, _c, _d, instruction) \ | 1148 | #define _foreach_move(_m, _c, _d, instruction) \ |
| 1100 | for (_m = 0; _m < 18; _m++) { _d = move(_c, _m); instruction } | 1149 | for (_m = 0; _m < 18; _m++) { _d = move(_c, _m); instruction } |
| 1150 | #define _foreach_trans(_t, _c, _d, instruction) \ | ||
| 1151 | for (_t = 0; _t < 48; _t++) { _d = transform(_c, _t); instruction } | ||
| 1152 | #endif | ||
| 1101 | 1153 | ||
| 1102 | cube_t solvedcube(void); | 1154 | cube_t solvedcube(void); |
| 1103 | bool isconsistent(cube_t); | 1155 | bool isconsistent(cube_t); |
| @@ -1941,14 +1993,14 @@ dfs_cocsep( | |||
| 1941 | if ((buf32[i] & 0xFFU) != 0xFFU) | 1993 | if ((buf32[i] & 0xFFU) != 0xFFU) |
| 1942 | return 0; | 1994 | return 0; |
| 1943 | 1995 | ||
| 1944 | for (t = 0, cc = 0; t < 48; t++) { | 1996 | cc = 0; |
| 1945 | d = transform(c, t); | 1997 | _foreach_trans(t, c, d, |
| 1946 | i = coord_fast_cocsep(d); | 1998 | i = coord_fast_cocsep(d); |
| 1947 | visited[i] = true; | 1999 | visited[i] = true; |
| 1948 | tinv = inverse_trans(t); | 2000 | tinv = inverse_trans(t); |
| 1949 | cc += (buf32[i] & 0xFFU) == 0xFFU; | 2001 | cc += (buf32[i] & 0xFFU) == 0xFFU; |
| 1950 | buf32[i] = (*n << 16U) | (tinv << 8U) | depth; | 2002 | buf32[i] = (*n << 16U) | (tinv << 8U) | depth; |
| 1951 | } | 2003 | ) |
| 1952 | (*n)++; | 2004 | (*n)++; |
| 1953 | 2005 | ||
| 1954 | return cc; | 2006 | return cc; |
