|
@ -284,82 +284,97 @@ void S2Mover::two_space_b(uint64_t code, int offset) const { |
|
|
} while (false); |
|
|
} while (false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void S2Mover::one_space(uint64_t code, int offset) const { |
|
|
template <int N> |
|
|
// ---------------- case up ----------------
|
|
|
void S2Mover::one_space(uint64_t code) const { |
|
|
|
|
|
if constexpr(N >= 4) { // case up
|
|
|
do { |
|
|
if (APPLY_MASK(code, N - 4, 0b111) == BLOCK_1x1) { |
|
|
if (offset >= 4) { |
|
|
release_(SET_1x1(UNSET_1x1(code, N - 4), N)); |
|
|
/// 1x1
|
|
|
} else if constexpr(N >= 8) { |
|
|
if (APPLY_MASK(code, offset - 4, 0b111) == 0b011) { |
|
|
if (APPLY_MASK(code, N - 8, 0b111) == BLOCK_2x1) { |
|
|
release_(SET_1x1(UNSET_1x1(code, offset - 4), offset)); |
|
|
release_(SET_2x1(UNSET_2x1(code, N - 8), N - 4)); |
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (offset >= 8) { |
|
|
|
|
|
/// 2x1
|
|
|
|
|
|
if (APPLY_MASK(code, offset - 8, 0b111'000'000'000'111) == 0b111'000'000'000'010) { |
|
|
|
|
|
release_(SET_2x1(UNSET_2x1(code, offset - 8), offset - 4)); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} while (false); |
|
|
} |
|
|
|
|
|
|
|
|
// ---------------- case down ----------------
|
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
if constexpr(N < 16) { // case down
|
|
|
if (offset < 16) { |
|
|
const uint8_t block = APPLY_MASK(code, N + 4, 0b111); |
|
|
/// 1x1
|
|
|
if (block == BLOCK_1x1) { |
|
|
if (APPLY_MASK(code, offset + 4, 0b111) == 0b011) { |
|
|
release_(SET_1x1(UNSET_1x1(code, N + 4), N)); |
|
|
release_(SET_1x1(UNSET_1x1(code, offset + 4), offset)); |
|
|
} else if constexpr(N < 12) { |
|
|
break; |
|
|
if (block == BLOCK_2x1) { |
|
|
|
|
|
release_(SET_2x1(UNSET_2x1(code, N + 4), N)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (offset < 12) { |
|
|
} |
|
|
/// 2x1
|
|
|
|
|
|
if (APPLY_MASK(code, offset + 4, 0b111'000'000'000'111) == 0b111'000'000'000'010) { |
|
|
|
|
|
release_(SET_2x1(UNSET_2x1(code, offset + 4), offset)); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} while (false); |
|
|
|
|
|
|
|
|
|
|
|
// ---------------- case left ----------------
|
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
if constexpr(N % 4 != 0) { // case left
|
|
|
if ((offset % 4) != 0) { |
|
|
if (APPLY_MASK(code, N - 1, 0b111) == BLOCK_1x1) { |
|
|
/// 1x1
|
|
|
release_(SET_1x1(UNSET_1x1(code, N - 1), N)); |
|
|
if (APPLY_MASK(code, offset - 1, 0b111) == 0b011) { |
|
|
} else if constexpr(N % 4 >= 2) { |
|
|
release_(SET_1x1(UNSET_1x1(code, offset - 1), offset)); |
|
|
if (APPLY_MASK(code, N - 2, 0b111) == BLOCK_1x2) { |
|
|
break; |
|
|
release_(SET_1x2(UNSET_1x2(code, N - 2), N - 1)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if ((offset % 4) >= 2) { |
|
|
} |
|
|
/// 1x2
|
|
|
|
|
|
if (APPLY_MASK(code, offset - 2, 0b111'111) == 0b111'001) { |
|
|
|
|
|
release_(SET_1x2(UNSET_1x2(code, offset - 2), offset - 1)); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} while (false); |
|
|
|
|
|
|
|
|
|
|
|
// ---------------- case right ----------------
|
|
|
|
|
|
|
|
|
|
|
|
do { |
|
|
if constexpr(N % 4 != 3) { // case right
|
|
|
if ((offset % 4) != 3) { |
|
|
const uint8_t block = APPLY_MASK(code, N + 1, 0b111); |
|
|
/// 1x1
|
|
|
if (block == BLOCK_1x1) { |
|
|
if (APPLY_MASK(code, offset + 1, 0b111) == 0b011) { |
|
|
release_(SET_1x1(UNSET_1x1(code, N + 1), N)); |
|
|
release_(SET_1x1(UNSET_1x1(code, offset + 1), offset)); |
|
|
} else if constexpr(N % 4 <= 1) { |
|
|
break; |
|
|
if (block == BLOCK_1x2) { |
|
|
|
|
|
release_(SET_1x2(UNSET_1x2(code, N + 1), N)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if ((offset % 4) <= 1) { |
|
|
} |
|
|
/// 1x2
|
|
|
} |
|
|
if (APPLY_MASK(code, offset + 1, 0b111'111) == 0b111'001) { |
|
|
|
|
|
release_(SET_1x2(UNSET_1x2(code, offset + 1), offset)); |
|
|
void S2Mover::one_space_(uint64_t code, int offset) const { |
|
|
break; |
|
|
switch (offset) { |
|
|
} |
|
|
// case 0: return one_space<0>(code);
|
|
|
} |
|
|
// case 1: return one_space<1>(code);
|
|
|
} while (false); |
|
|
// case 2: return one_space<2>(code);
|
|
|
|
|
|
// case 3: return one_space<3>(code);
|
|
|
|
|
|
// case 4: return one_space<4>(code);
|
|
|
|
|
|
// case 5: return one_space<5>(code);
|
|
|
|
|
|
// case 6: return one_space<6>(code);
|
|
|
|
|
|
// case 7: return one_space<7>(code);
|
|
|
|
|
|
// case 8: return one_space<8>(code);
|
|
|
|
|
|
// case 9: return one_space<9>(code);
|
|
|
|
|
|
// case 10: return one_space<10>(code);
|
|
|
|
|
|
// case 11: return one_space<11>(code);
|
|
|
|
|
|
// case 12: return one_space<12>(code);
|
|
|
|
|
|
// case 13: return one_space<13>(code);
|
|
|
|
|
|
// case 14: return one_space<14>(code);
|
|
|
|
|
|
// case 15: return one_space<15>(code);
|
|
|
|
|
|
// case 16: return one_space<16>(code);
|
|
|
|
|
|
// case 17: return one_space<17>(code);
|
|
|
|
|
|
// case 18: return one_space<18>(code);
|
|
|
|
|
|
// case 19: return one_space<19>(code);
|
|
|
|
|
|
|
|
|
|
|
|
case 0: one_space<0>(code); break; |
|
|
|
|
|
case 1: one_space<1>(code); break; |
|
|
|
|
|
case 2: one_space<2>(code); break; |
|
|
|
|
|
case 3: one_space<3>(code); break; |
|
|
|
|
|
case 4: one_space<4>(code); break; |
|
|
|
|
|
case 5: one_space<5>(code); break; |
|
|
|
|
|
case 6: one_space<6>(code); break; |
|
|
|
|
|
case 7: one_space<7>(code); break; |
|
|
|
|
|
case 8: one_space<8>(code); break; |
|
|
|
|
|
case 9: one_space<9>(code); break; |
|
|
|
|
|
case 10: one_space<10>(code); break; |
|
|
|
|
|
case 11: one_space<11>(code); break; |
|
|
|
|
|
case 12: one_space<12>(code); break; |
|
|
|
|
|
case 13: one_space<13>(code); break; |
|
|
|
|
|
case 14: one_space<14>(code); break; |
|
|
|
|
|
case 15: one_space<15>(code); break; |
|
|
|
|
|
case 16: one_space<16>(code); break; |
|
|
|
|
|
case 17: one_space<17>(code); break; |
|
|
|
|
|
case 18: one_space<18>(code); break; |
|
|
|
|
|
case 19: one_space<19>(code); break; |
|
|
|
|
|
|
|
|
|
|
|
default: std::unreachable(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void S2Mover::next_cases(uint64_t code) { |
|
|
void S2Mover::next_cases(uint64_t code) { |
|
@ -402,7 +417,7 @@ void S2Mover::next_cases(uint64_t code) { |
|
|
} else if (space_1 + 4 == space_2) { |
|
|
} else if (space_1 + 4 == space_2) { |
|
|
two_space_b(code, space_1); |
|
|
two_space_b(code, space_1); |
|
|
} else { |
|
|
} else { |
|
|
one_space(code, space_1); |
|
|
one_space_(code, space_1); |
|
|
one_space(code, space_2); |
|
|
one_space_(code, space_2); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|