mirror of https://github.com/dnomd343/klotski.git
Dnomd343
2 months ago
7 changed files with 210 additions and 56 deletions
@ -0,0 +1,16 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
namespace klotski::cases { |
||||
|
|
||||
|
KLSK_INLINE_H void Ranges::reverse() { |
||||
|
for (auto &x : *this) { |
||||
|
x = range_reverse(x); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
inline Ranges& Ranges::operator+=(const Ranges &ranges) { |
||||
|
this->insert(this->end(), ranges.begin(), ranges.end()); |
||||
|
return *this; |
||||
|
} |
||||
|
|
||||
|
} // namespace klotski::cases |
@ -0,0 +1,35 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
namespace klotski::cases { |
||||
|
|
||||
|
inline Ranges& RangesUnion::ranges(const size_t head) { |
||||
|
return std::array<Ranges, 16>::operator[](head); |
||||
|
} |
||||
|
|
||||
|
inline const Ranges& RangesUnion::ranges(const size_t head) const { |
||||
|
return std::array<Ranges, 16>::operator[](head); |
||||
|
} |
||||
|
|
||||
|
KLSK_INLINE_H size_t RangesUnion::size() const { |
||||
|
size_type size = 0; |
||||
|
#pragma unroll |
||||
|
for (const auto head : Heads) { |
||||
|
size += ranges(head).size(); |
||||
|
} |
||||
|
return size; |
||||
|
} |
||||
|
|
||||
|
// KLSK_INLINE_H uint32_t RangesUnion::operator[](size_type n) const { |
||||
|
// size_t head = 0; |
||||
|
// for (;;) { |
||||
|
// if (n >= ranges(head).size()) { |
||||
|
// n -= ranges(head).size(); |
||||
|
// ++head; |
||||
|
// } else { |
||||
|
// break; |
||||
|
// } |
||||
|
// } |
||||
|
// return ranges(head)[n]; |
||||
|
// } |
||||
|
|
||||
|
} // namespace klotski::cases |
Loading…
Reference in new issue