|
@ -5,20 +5,30 @@ using klotski::cases::Ranges; |
|
|
using klotski::codec::CommonCode; |
|
|
using klotski::codec::CommonCode; |
|
|
using klotski::cases::RangesUnion; |
|
|
using klotski::cases::RangesUnion; |
|
|
|
|
|
|
|
|
|
|
|
static constexpr auto heads = std::to_array<uint64_t>({ |
|
|
|
|
|
0x0, 0x1, 0x2, 0x4, 0x5, 0x6, |
|
|
|
|
|
0x8, 0x9, 0xA, 0xC, 0xD, 0xE, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
void Ranges::reverse() { |
|
|
void Ranges::reverse() { |
|
|
for (auto &x : *this) { |
|
|
for (auto &x : *this) { |
|
|
x = range_reverse(x); |
|
|
x = range_reverse(x); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
std::vector<CommonCode> RangesUnion::codes() const { |
|
|
Ranges& Ranges::operator+=(const Ranges &ranges) { |
|
|
constexpr auto heads = std::to_array<uint64_t>({ |
|
|
this->insert(this->end(), ranges.begin(), ranges.end()); |
|
|
0x0, 0x1, 0x2, |
|
|
return *this; |
|
|
0x4, 0x5, 0x6, |
|
|
} |
|
|
0x8, 0x9, 0xA, |
|
|
|
|
|
0xC, 0xD, 0xE, |
|
|
RangesUnion& RangesUnion::operator+=(const RangesUnion &ranges_union) { |
|
|
}); |
|
|
for (const auto head : heads) { |
|
|
|
|
|
(*this)[head] += ranges_union[head]; |
|
|
|
|
|
} |
|
|
|
|
|
return *this; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::vector<CommonCode> RangesUnion::codes() const { |
|
|
size_type size = 0; |
|
|
size_type size = 0; |
|
|
for (const auto head : heads) { |
|
|
for (const auto head : heads) { |
|
|
size += (*this)[head].size(); |
|
|
size += (*this)[head].size(); |
|
|