diff options
| author | 2023-01-29 19:52:38 -0500 | |
|---|---|---|
| committer | 2023-01-29 19:52:38 -0500 | |
| commit | 5f4647df7da58aa22be21dd26cfa6de7c5f106c9 (patch) | |
| tree | 4bbcaee76bde35ddc6eff9a1c639866cf278b353 | |
| parent | Merge pull request #9699 from ameerj/texture-pass-desc (diff) | |
| parent | Move to Clang Format 15 (diff) | |
| download | yuzu-5f4647df7da58aa22be21dd26cfa6de7c5f106c9.tar.gz yuzu-5f4647df7da58aa22be21dd26cfa6de7c5f106c9.tar.xz yuzu-5f4647df7da58aa22be21dd26cfa6de7c5f106c9.zip | |
Merge pull request #9705 from behunin/patch-1
Move to Clang Format 15
26 files changed, 186 insertions, 190 deletions
diff --git a/.ci/scripts/format/script.sh b/.ci/scripts/format/script.sh index 225bbc972..25b0718f0 100755 --- a/.ci/scripts/format/script.sh +++ b/.ci/scripts/format/script.sh | |||
| @@ -10,7 +10,7 @@ if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dis | |||
| 10 | fi | 10 | fi |
| 11 | 11 | ||
| 12 | # Default clang-format points to default 3.5 version one | 12 | # Default clang-format points to default 3.5 version one |
| 13 | CLANG_FORMAT=${CLANG_FORMAT:-clang-format-12} | 13 | CLANG_FORMAT=${CLANG_FORMAT:-clang-format-15} |
| 14 | $CLANG_FORMAT --version | 14 | $CLANG_FORMAT --version |
| 15 | 15 | ||
| 16 | if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then | 16 | if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then |
diff --git a/src/common/address_space.h b/src/common/address_space.h index 9222b2fdc..8683c23c3 100644 --- a/src/common/address_space.h +++ b/src/common/address_space.h | |||
| @@ -12,7 +12,8 @@ | |||
| 12 | 12 | ||
| 13 | namespace Common { | 13 | namespace Common { |
| 14 | template <typename VaType, size_t AddressSpaceBits> | 14 | template <typename VaType, size_t AddressSpaceBits> |
| 15 | concept AddressSpaceValid = std::is_unsigned_v<VaType> && sizeof(VaType) * 8 >= AddressSpaceBits; | 15 | concept AddressSpaceValid = std::is_unsigned_v<VaType> && sizeof(VaType) * 8 >= |
| 16 | AddressSpaceBits; | ||
| 16 | 17 | ||
| 17 | struct EmptyStruct {}; | 18 | struct EmptyStruct {}; |
| 18 | 19 | ||
| @@ -21,7 +22,7 @@ struct EmptyStruct {}; | |||
| 21 | */ | 22 | */ |
| 22 | template <typename VaType, VaType UnmappedVa, typename PaType, PaType UnmappedPa, | 23 | template <typename VaType, VaType UnmappedVa, typename PaType, PaType UnmappedPa, |
| 23 | bool PaContigSplit, size_t AddressSpaceBits, typename ExtraBlockInfo = EmptyStruct> | 24 | bool PaContigSplit, size_t AddressSpaceBits, typename ExtraBlockInfo = EmptyStruct> |
| 24 | requires AddressSpaceValid<VaType, AddressSpaceBits> | 25 | requires AddressSpaceValid<VaType, AddressSpaceBits> |
| 25 | class FlatAddressSpaceMap { | 26 | class FlatAddressSpaceMap { |
| 26 | public: | 27 | public: |
| 27 | /// The maximum VA that this AS can technically reach | 28 | /// The maximum VA that this AS can technically reach |
| @@ -109,7 +110,7 @@ private: | |||
| 109 | * initial, fast linear pass and a subsequent slower pass that iterates until it finds a free block | 110 | * initial, fast linear pass and a subsequent slower pass that iterates until it finds a free block |
| 110 | */ | 111 | */ |
| 111 | template <typename VaType, VaType UnmappedVa, size_t AddressSpaceBits> | 112 | template <typename VaType, VaType UnmappedVa, size_t AddressSpaceBits> |
| 112 | requires AddressSpaceValid<VaType, AddressSpaceBits> | 113 | requires AddressSpaceValid<VaType, AddressSpaceBits> |
| 113 | class FlatAllocator | 114 | class FlatAllocator |
| 114 | : public FlatAddressSpaceMap<VaType, UnmappedVa, bool, false, false, AddressSpaceBits> { | 115 | : public FlatAddressSpaceMap<VaType, UnmappedVa, bool, false, false, AddressSpaceBits> { |
| 115 | private: | 116 | private: |
diff --git a/src/common/alignment.h b/src/common/alignment.h index 7e897334b..fa715d497 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | namespace Common { | 10 | namespace Common { |
| 11 | 11 | ||
| 12 | template <typename T> | 12 | template <typename T> |
| 13 | requires std::is_unsigned_v<T> | 13 | requires std::is_unsigned_v<T> |
| 14 | [[nodiscard]] constexpr T AlignUp(T value, size_t size) { | 14 | [[nodiscard]] constexpr T AlignUp(T value, size_t size) { |
| 15 | auto mod{static_cast<T>(value % size)}; | 15 | auto mod{static_cast<T>(value % size)}; |
| 16 | value -= mod; | 16 | value -= mod; |
| @@ -18,31 +18,31 @@ requires std::is_unsigned_v<T> | |||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | template <typename T> | 20 | template <typename T> |
| 21 | requires std::is_unsigned_v<T> | 21 | requires std::is_unsigned_v<T> |
| 22 | [[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { | 22 | [[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { |
| 23 | return static_cast<T>((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2); | 23 | return static_cast<T>((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | template <typename T> | 26 | template <typename T> |
| 27 | requires std::is_unsigned_v<T> | 27 | requires std::is_unsigned_v<T> |
| 28 | [[nodiscard]] constexpr T AlignDown(T value, size_t size) { | 28 | [[nodiscard]] constexpr T AlignDown(T value, size_t size) { |
| 29 | return static_cast<T>(value - value % size); | 29 | return static_cast<T>(value - value % size); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | template <typename T> | 32 | template <typename T> |
| 33 | requires std::is_unsigned_v<T> | 33 | requires std::is_unsigned_v<T> |
| 34 | [[nodiscard]] constexpr bool Is4KBAligned(T value) { | 34 | [[nodiscard]] constexpr bool Is4KBAligned(T value) { |
| 35 | return (value & 0xFFF) == 0; | 35 | return (value & 0xFFF) == 0; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | template <typename T> | 38 | template <typename T> |
| 39 | requires std::is_unsigned_v<T> | 39 | requires std::is_unsigned_v<T> |
| 40 | [[nodiscard]] constexpr bool IsWordAligned(T value) { | 40 | [[nodiscard]] constexpr bool IsWordAligned(T value) { |
| 41 | return (value & 0b11) == 0; | 41 | return (value & 0b11) == 0; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | template <typename T> | 44 | template <typename T> |
| 45 | requires std::is_integral_v<T> | 45 | requires std::is_integral_v<T> |
| 46 | [[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { | 46 | [[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { |
| 47 | using U = typename std::make_unsigned_t<T>; | 47 | using U = typename std::make_unsigned_t<T>; |
| 48 | const U mask = static_cast<U>(alignment - 1); | 48 | const U mask = static_cast<U>(alignment - 1); |
| @@ -50,7 +50,7 @@ requires std::is_integral_v<T> | |||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | template <typename T, typename U> | 52 | template <typename T, typename U> |
| 53 | requires std::is_integral_v<T> | 53 | requires std::is_integral_v<T> |
| 54 | [[nodiscard]] constexpr T DivideUp(T x, U y) { | 54 | [[nodiscard]] constexpr T DivideUp(T x, U y) { |
| 55 | return (x + (y - 1)) / y; | 55 | return (x + (y - 1)) / y; |
| 56 | } | 56 | } |
| @@ -73,11 +73,11 @@ public: | |||
| 73 | constexpr AlignmentAllocator(const AlignmentAllocator<T2, Align>&) noexcept {} | 73 | constexpr AlignmentAllocator(const AlignmentAllocator<T2, Align>&) noexcept {} |
| 74 | 74 | ||
| 75 | [[nodiscard]] T* allocate(size_type n) { | 75 | [[nodiscard]] T* allocate(size_type n) { |
| 76 | return static_cast<T*>(::operator new (n * sizeof(T), std::align_val_t{Align})); | 76 | return static_cast<T*>(::operator new(n * sizeof(T), std::align_val_t{Align})); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void deallocate(T* p, size_type n) { | 79 | void deallocate(T* p, size_type n) { |
| 80 | ::operator delete (p, n * sizeof(T), std::align_val_t{Align}); | 80 | ::operator delete(p, n * sizeof(T), std::align_val_t{Align}); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | template <typename T2> | 83 | template <typename T2> |
diff --git a/src/common/atomic_helpers.h b/src/common/atomic_helpers.h index aef3b66a4..d997f10ba 100644 --- a/src/common/atomic_helpers.h +++ b/src/common/atomic_helpers.h | |||
| @@ -75,7 +75,7 @@ extern "C" void AnnotateHappensAfter(const char*, int, void*); | |||
| 75 | #if defined(AE_VCPP) || defined(AE_ICC) | 75 | #if defined(AE_VCPP) || defined(AE_ICC) |
| 76 | #define AE_FORCEINLINE __forceinline | 76 | #define AE_FORCEINLINE __forceinline |
| 77 | #elif defined(AE_GCC) | 77 | #elif defined(AE_GCC) |
| 78 | //#define AE_FORCEINLINE __attribute__((always_inline)) | 78 | // #define AE_FORCEINLINE __attribute__((always_inline)) |
| 79 | #define AE_FORCEINLINE inline | 79 | #define AE_FORCEINLINE inline |
| 80 | #else | 80 | #else |
| 81 | #define AE_FORCEINLINE inline | 81 | #define AE_FORCEINLINE inline |
diff --git a/src/common/bit_util.h b/src/common/bit_util.h index e4e6287f3..13368b439 100644 --- a/src/common/bit_util.h +++ b/src/common/bit_util.h | |||
| @@ -45,19 +45,19 @@ template <typename T> | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | template <typename T> | 47 | template <typename T> |
| 48 | requires std::is_unsigned_v<T> | 48 | requires std::is_unsigned_v<T> |
| 49 | [[nodiscard]] constexpr bool IsPow2(T value) { | 49 | [[nodiscard]] constexpr bool IsPow2(T value) { |
| 50 | return std::has_single_bit(value); | 50 | return std::has_single_bit(value); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | template <typename T> | 53 | template <typename T> |
| 54 | requires std::is_integral_v<T> | 54 | requires std::is_integral_v<T> |
| 55 | [[nodiscard]] T NextPow2(T value) { | 55 | [[nodiscard]] T NextPow2(T value) { |
| 56 | return static_cast<T>(1ULL << ((8U * sizeof(T)) - std::countl_zero(value - 1U))); | 56 | return static_cast<T>(1ULL << ((8U * sizeof(T)) - std::countl_zero(value - 1U))); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | template <size_t bit_index, typename T> | 59 | template <size_t bit_index, typename T> |
| 60 | requires std::is_integral_v<T> | 60 | requires std::is_integral_v<T> |
| 61 | [[nodiscard]] constexpr bool Bit(const T value) { | 61 | [[nodiscard]] constexpr bool Bit(const T value) { |
| 62 | static_assert(bit_index < BitSize<T>(), "bit_index must be smaller than size of T"); | 62 | static_assert(bit_index < BitSize<T>(), "bit_index must be smaller than size of T"); |
| 63 | return ((value >> bit_index) & T(1)) == T(1); | 63 | return ((value >> bit_index) & T(1)) == T(1); |
diff --git a/src/common/concepts.h b/src/common/concepts.h index a9acff3e7..61df1d32a 100644 --- a/src/common/concepts.h +++ b/src/common/concepts.h | |||
| @@ -16,9 +16,9 @@ concept IsContiguousContainer = std::contiguous_iterator<typename T::iterator>; | |||
| 16 | // is available on all supported platforms. | 16 | // is available on all supported platforms. |
| 17 | template <typename Derived, typename Base> | 17 | template <typename Derived, typename Base> |
| 18 | concept DerivedFrom = requires { | 18 | concept DerivedFrom = requires { |
| 19 | std::is_base_of_v<Base, Derived>; | 19 | std::is_base_of_v<Base, Derived>; |
| 20 | std::is_convertible_v<const volatile Derived*, const volatile Base*>; | 20 | std::is_convertible_v<const volatile Derived*, const volatile Base*>; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | // TODO: Replace with std::convertible_to when libc++ implements it. | 23 | // TODO: Replace with std::convertible_to when libc++ implements it. |
| 24 | template <typename From, typename To> | 24 | template <typename From, typename To> |
diff --git a/src/common/div_ceil.h b/src/common/div_ceil.h index eebc279c2..c12477d42 100644 --- a/src/common/div_ceil.h +++ b/src/common/div_ceil.h | |||
| @@ -10,14 +10,14 @@ namespace Common { | |||
| 10 | 10 | ||
| 11 | /// Ceiled integer division. | 11 | /// Ceiled integer division. |
| 12 | template <typename N, typename D> | 12 | template <typename N, typename D> |
| 13 | requires std::is_integral_v<N> && std::is_unsigned_v<D> | 13 | requires std::is_integral_v<N> && std::is_unsigned_v<D> |
| 14 | [[nodiscard]] constexpr N DivCeil(N number, D divisor) { | 14 | [[nodiscard]] constexpr N DivCeil(N number, D divisor) { |
| 15 | return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor); | 15 | return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | /// Ceiled integer division with logarithmic divisor in base 2 | 18 | /// Ceiled integer division with logarithmic divisor in base 2 |
| 19 | template <typename N, typename D> | 19 | template <typename N, typename D> |
| 20 | requires std::is_integral_v<N> && std::is_unsigned_v<D> | 20 | requires std::is_integral_v<N> && std::is_unsigned_v<D> |
| 21 | [[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) { | 21 | [[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) { |
| 22 | return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); | 22 | return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); |
| 23 | } | 23 | } |
diff --git a/src/common/expected.h b/src/common/expected.h index 6e6c86ee7..5fccfbcbd 100644 --- a/src/common/expected.h +++ b/src/common/expected.h | |||
| @@ -64,7 +64,7 @@ struct no_init_t { | |||
| 64 | * Additionally, this requires E to be trivially destructible | 64 | * Additionally, this requires E to be trivially destructible |
| 65 | */ | 65 | */ |
| 66 | template <typename T, typename E, bool = std::is_trivially_destructible_v<T>> | 66 | template <typename T, typename E, bool = std::is_trivially_destructible_v<T>> |
| 67 | requires std::is_trivially_destructible_v<E> | 67 | requires std::is_trivially_destructible_v<E> |
| 68 | struct expected_storage_base { | 68 | struct expected_storage_base { |
| 69 | constexpr expected_storage_base() : m_val{T{}}, m_has_val{true} {} | 69 | constexpr expected_storage_base() : m_val{T{}}, m_has_val{true} {} |
| 70 | 70 | ||
| @@ -111,7 +111,7 @@ struct expected_storage_base { | |||
| 111 | * Additionally, this requires E to be trivially destructible | 111 | * Additionally, this requires E to be trivially destructible |
| 112 | */ | 112 | */ |
| 113 | template <typename T, typename E> | 113 | template <typename T, typename E> |
| 114 | requires std::is_trivially_destructible_v<E> | 114 | requires std::is_trivially_destructible_v<E> |
| 115 | struct expected_storage_base<T, E, true> { | 115 | struct expected_storage_base<T, E, true> { |
| 116 | constexpr expected_storage_base() : m_val{T{}}, m_has_val{true} {} | 116 | constexpr expected_storage_base() : m_val{T{}}, m_has_val{true} {} |
| 117 | 117 | ||
| @@ -251,7 +251,7 @@ struct expected_operations_base : expected_storage_base<T, E> { | |||
| 251 | * Additionally, this requires E to be trivially copy constructible | 251 | * Additionally, this requires E to be trivially copy constructible |
| 252 | */ | 252 | */ |
| 253 | template <typename T, typename E, bool = std::is_trivially_copy_constructible_v<T>> | 253 | template <typename T, typename E, bool = std::is_trivially_copy_constructible_v<T>> |
| 254 | requires std::is_trivially_copy_constructible_v<E> | 254 | requires std::is_trivially_copy_constructible_v<E> |
| 255 | struct expected_copy_base : expected_operations_base<T, E> { | 255 | struct expected_copy_base : expected_operations_base<T, E> { |
| 256 | using expected_operations_base<T, E>::expected_operations_base; | 256 | using expected_operations_base<T, E>::expected_operations_base; |
| 257 | }; | 257 | }; |
| @@ -261,7 +261,7 @@ struct expected_copy_base : expected_operations_base<T, E> { | |||
| 261 | * Additionally, this requires E to be trivially copy constructible | 261 | * Additionally, this requires E to be trivially copy constructible |
| 262 | */ | 262 | */ |
| 263 | template <typename T, typename E> | 263 | template <typename T, typename E> |
| 264 | requires std::is_trivially_copy_constructible_v<E> | 264 | requires std::is_trivially_copy_constructible_v<E> |
| 265 | struct expected_copy_base<T, E, false> : expected_operations_base<T, E> { | 265 | struct expected_copy_base<T, E, false> : expected_operations_base<T, E> { |
| 266 | using expected_operations_base<T, E>::expected_operations_base; | 266 | using expected_operations_base<T, E>::expected_operations_base; |
| 267 | 267 | ||
| @@ -289,7 +289,7 @@ struct expected_copy_base<T, E, false> : expected_operations_base<T, E> { | |||
| 289 | * Additionally, this requires E to be trivially move constructible | 289 | * Additionally, this requires E to be trivially move constructible |
| 290 | */ | 290 | */ |
| 291 | template <typename T, typename E, bool = std::is_trivially_move_constructible_v<T>> | 291 | template <typename T, typename E, bool = std::is_trivially_move_constructible_v<T>> |
| 292 | requires std::is_trivially_move_constructible_v<E> | 292 | requires std::is_trivially_move_constructible_v<E> |
| 293 | struct expected_move_base : expected_copy_base<T, E> { | 293 | struct expected_move_base : expected_copy_base<T, E> { |
| 294 | using expected_copy_base<T, E>::expected_copy_base; | 294 | using expected_copy_base<T, E>::expected_copy_base; |
| 295 | }; | 295 | }; |
| @@ -299,7 +299,7 @@ struct expected_move_base : expected_copy_base<T, E> { | |||
| 299 | * Additionally, this requires E to be trivially move constructible | 299 | * Additionally, this requires E to be trivially move constructible |
| 300 | */ | 300 | */ |
| 301 | template <typename T, typename E> | 301 | template <typename T, typename E> |
| 302 | requires std::is_trivially_move_constructible_v<E> | 302 | requires std::is_trivially_move_constructible_v<E> |
| 303 | struct expected_move_base<T, E, false> : expected_copy_base<T, E> { | 303 | struct expected_move_base<T, E, false> : expected_copy_base<T, E> { |
| 304 | using expected_copy_base<T, E>::expected_copy_base; | 304 | using expected_copy_base<T, E>::expected_copy_base; |
| 305 | 305 | ||
| @@ -330,9 +330,9 @@ template <typename T, typename E, | |||
| 330 | bool = std::conjunction_v<std::is_trivially_copy_assignable<T>, | 330 | bool = std::conjunction_v<std::is_trivially_copy_assignable<T>, |
| 331 | std::is_trivially_copy_constructible<T>, | 331 | std::is_trivially_copy_constructible<T>, |
| 332 | std::is_trivially_destructible<T>>> | 332 | std::is_trivially_destructible<T>>> |
| 333 | requires std::conjunction_v<std::is_trivially_copy_assignable<E>, | 333 | requires std::conjunction_v<std::is_trivially_copy_assignable<E>, |
| 334 | std::is_trivially_copy_constructible<E>, | 334 | std::is_trivially_copy_constructible<E>, |
| 335 | std::is_trivially_destructible<E>> | 335 | std::is_trivially_destructible<E>> |
| 336 | struct expected_copy_assign_base : expected_move_base<T, E> { | 336 | struct expected_copy_assign_base : expected_move_base<T, E> { |
| 337 | using expected_move_base<T, E>::expected_move_base; | 337 | using expected_move_base<T, E>::expected_move_base; |
| 338 | }; | 338 | }; |
| @@ -342,9 +342,9 @@ struct expected_copy_assign_base : expected_move_base<T, E> { | |||
| 342 | * Additionally, this requires E to be trivially copy assignable | 342 | * Additionally, this requires E to be trivially copy assignable |
| 343 | */ | 343 | */ |
| 344 | template <typename T, typename E> | 344 | template <typename T, typename E> |
| 345 | requires std::conjunction_v<std::is_trivially_copy_assignable<E>, | 345 | requires std::conjunction_v<std::is_trivially_copy_assignable<E>, |
| 346 | std::is_trivially_copy_constructible<E>, | 346 | std::is_trivially_copy_constructible<E>, |
| 347 | std::is_trivially_destructible<E>> | 347 | std::is_trivially_destructible<E>> |
| 348 | struct expected_copy_assign_base<T, E, false> : expected_move_base<T, E> { | 348 | struct expected_copy_assign_base<T, E, false> : expected_move_base<T, E> { |
| 349 | using expected_move_base<T, E>::expected_move_base; | 349 | using expected_move_base<T, E>::expected_move_base; |
| 350 | 350 | ||
| @@ -371,9 +371,9 @@ template <typename T, typename E, | |||
| 371 | bool = std::conjunction_v<std::is_trivially_move_assignable<T>, | 371 | bool = std::conjunction_v<std::is_trivially_move_assignable<T>, |
| 372 | std::is_trivially_move_constructible<T>, | 372 | std::is_trivially_move_constructible<T>, |
| 373 | std::is_trivially_destructible<T>>> | 373 | std::is_trivially_destructible<T>>> |
| 374 | requires std::conjunction_v<std::is_trivially_move_assignable<E>, | 374 | requires std::conjunction_v<std::is_trivially_move_assignable<E>, |
| 375 | std::is_trivially_move_constructible<E>, | 375 | std::is_trivially_move_constructible<E>, |
| 376 | std::is_trivially_destructible<E>> | 376 | std::is_trivially_destructible<E>> |
| 377 | struct expected_move_assign_base : expected_copy_assign_base<T, E> { | 377 | struct expected_move_assign_base : expected_copy_assign_base<T, E> { |
| 378 | using expected_copy_assign_base<T, E>::expected_copy_assign_base; | 378 | using expected_copy_assign_base<T, E>::expected_copy_assign_base; |
| 379 | }; | 379 | }; |
| @@ -383,9 +383,9 @@ struct expected_move_assign_base : expected_copy_assign_base<T, E> { | |||
| 383 | * Additionally, this requires E to be trivially move assignable | 383 | * Additionally, this requires E to be trivially move assignable |
| 384 | */ | 384 | */ |
| 385 | template <typename T, typename E> | 385 | template <typename T, typename E> |
| 386 | requires std::conjunction_v<std::is_trivially_move_assignable<E>, | 386 | requires std::conjunction_v<std::is_trivially_move_assignable<E>, |
| 387 | std::is_trivially_move_constructible<E>, | 387 | std::is_trivially_move_constructible<E>, |
| 388 | std::is_trivially_destructible<E>> | 388 | std::is_trivially_destructible<E>> |
| 389 | struct expected_move_assign_base<T, E, false> : expected_copy_assign_base<T, E> { | 389 | struct expected_move_assign_base<T, E, false> : expected_copy_assign_base<T, E> { |
| 390 | using expected_copy_assign_base<T, E>::expected_copy_assign_base; | 390 | using expected_copy_assign_base<T, E>::expected_copy_assign_base; |
| 391 | 391 | ||
| @@ -412,7 +412,7 @@ struct expected_move_assign_base<T, E, false> : expected_copy_assign_base<T, E> | |||
| 412 | */ | 412 | */ |
| 413 | template <typename T, typename E, bool EnableCopy = std::is_copy_constructible_v<T>, | 413 | template <typename T, typename E, bool EnableCopy = std::is_copy_constructible_v<T>, |
| 414 | bool EnableMove = std::is_move_constructible_v<T>> | 414 | bool EnableMove = std::is_move_constructible_v<T>> |
| 415 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>> | 415 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>> |
| 416 | struct expected_delete_ctor_base { | 416 | struct expected_delete_ctor_base { |
| 417 | expected_delete_ctor_base() = default; | 417 | expected_delete_ctor_base() = default; |
| 418 | expected_delete_ctor_base(const expected_delete_ctor_base&) = default; | 418 | expected_delete_ctor_base(const expected_delete_ctor_base&) = default; |
| @@ -422,7 +422,7 @@ struct expected_delete_ctor_base { | |||
| 422 | }; | 422 | }; |
| 423 | 423 | ||
| 424 | template <typename T, typename E> | 424 | template <typename T, typename E> |
| 425 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>> | 425 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>> |
| 426 | struct expected_delete_ctor_base<T, E, true, false> { | 426 | struct expected_delete_ctor_base<T, E, true, false> { |
| 427 | expected_delete_ctor_base() = default; | 427 | expected_delete_ctor_base() = default; |
| 428 | expected_delete_ctor_base(const expected_delete_ctor_base&) = default; | 428 | expected_delete_ctor_base(const expected_delete_ctor_base&) = default; |
| @@ -432,7 +432,7 @@ struct expected_delete_ctor_base<T, E, true, false> { | |||
| 432 | }; | 432 | }; |
| 433 | 433 | ||
| 434 | template <typename T, typename E> | 434 | template <typename T, typename E> |
| 435 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>> | 435 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>> |
| 436 | struct expected_delete_ctor_base<T, E, false, true> { | 436 | struct expected_delete_ctor_base<T, E, false, true> { |
| 437 | expected_delete_ctor_base() = default; | 437 | expected_delete_ctor_base() = default; |
| 438 | expected_delete_ctor_base(const expected_delete_ctor_base&) = delete; | 438 | expected_delete_ctor_base(const expected_delete_ctor_base&) = delete; |
| @@ -442,7 +442,7 @@ struct expected_delete_ctor_base<T, E, false, true> { | |||
| 442 | }; | 442 | }; |
| 443 | 443 | ||
| 444 | template <typename T, typename E> | 444 | template <typename T, typename E> |
| 445 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>> | 445 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>> |
| 446 | struct expected_delete_ctor_base<T, E, false, false> { | 446 | struct expected_delete_ctor_base<T, E, false, false> { |
| 447 | expected_delete_ctor_base() = default; | 447 | expected_delete_ctor_base() = default; |
| 448 | expected_delete_ctor_base(const expected_delete_ctor_base&) = delete; | 448 | expected_delete_ctor_base(const expected_delete_ctor_base&) = delete; |
| @@ -460,8 +460,8 @@ template < | |||
| 460 | typename T, typename E, | 460 | typename T, typename E, |
| 461 | bool EnableCopy = std::conjunction_v<std::is_copy_constructible<T>, std::is_copy_assignable<T>>, | 461 | bool EnableCopy = std::conjunction_v<std::is_copy_constructible<T>, std::is_copy_assignable<T>>, |
| 462 | bool EnableMove = std::conjunction_v<std::is_move_constructible<T>, std::is_move_assignable<T>>> | 462 | bool EnableMove = std::conjunction_v<std::is_move_constructible<T>, std::is_move_assignable<T>>> |
| 463 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>, | 463 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>, |
| 464 | std::is_copy_assignable<E>, std::is_move_assignable<E>> | 464 | std::is_copy_assignable<E>, std::is_move_assignable<E>> |
| 465 | struct expected_delete_assign_base { | 465 | struct expected_delete_assign_base { |
| 466 | expected_delete_assign_base() = default; | 466 | expected_delete_assign_base() = default; |
| 467 | expected_delete_assign_base(const expected_delete_assign_base&) = default; | 467 | expected_delete_assign_base(const expected_delete_assign_base&) = default; |
| @@ -471,8 +471,8 @@ struct expected_delete_assign_base { | |||
| 471 | }; | 471 | }; |
| 472 | 472 | ||
| 473 | template <typename T, typename E> | 473 | template <typename T, typename E> |
| 474 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>, | 474 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>, |
| 475 | std::is_copy_assignable<E>, std::is_move_assignable<E>> | 475 | std::is_copy_assignable<E>, std::is_move_assignable<E>> |
| 476 | struct expected_delete_assign_base<T, E, true, false> { | 476 | struct expected_delete_assign_base<T, E, true, false> { |
| 477 | expected_delete_assign_base() = default; | 477 | expected_delete_assign_base() = default; |
| 478 | expected_delete_assign_base(const expected_delete_assign_base&) = default; | 478 | expected_delete_assign_base(const expected_delete_assign_base&) = default; |
| @@ -482,8 +482,8 @@ struct expected_delete_assign_base<T, E, true, false> { | |||
| 482 | }; | 482 | }; |
| 483 | 483 | ||
| 484 | template <typename T, typename E> | 484 | template <typename T, typename E> |
| 485 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>, | 485 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>, |
| 486 | std::is_copy_assignable<E>, std::is_move_assignable<E>> | 486 | std::is_copy_assignable<E>, std::is_move_assignable<E>> |
| 487 | struct expected_delete_assign_base<T, E, false, true> { | 487 | struct expected_delete_assign_base<T, E, false, true> { |
| 488 | expected_delete_assign_base() = default; | 488 | expected_delete_assign_base() = default; |
| 489 | expected_delete_assign_base(const expected_delete_assign_base&) = default; | 489 | expected_delete_assign_base(const expected_delete_assign_base&) = default; |
| @@ -493,8 +493,8 @@ struct expected_delete_assign_base<T, E, false, true> { | |||
| 493 | }; | 493 | }; |
| 494 | 494 | ||
| 495 | template <typename T, typename E> | 495 | template <typename T, typename E> |
| 496 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>, | 496 | requires std::conjunction_v<std::is_copy_constructible<E>, std::is_move_constructible<E>, |
| 497 | std::is_copy_assignable<E>, std::is_move_assignable<E>> | 497 | std::is_copy_assignable<E>, std::is_move_assignable<E>> |
| 498 | struct expected_delete_assign_base<T, E, false, false> { | 498 | struct expected_delete_assign_base<T, E, false, false> { |
| 499 | expected_delete_assign_base() = default; | 499 | expected_delete_assign_base() = default; |
| 500 | expected_delete_assign_base(const expected_delete_assign_base&) = default; | 500 | expected_delete_assign_base(const expected_delete_assign_base&) = default; |
diff --git a/src/common/intrusive_red_black_tree.h b/src/common/intrusive_red_black_tree.h index 93046615e..5f6b34e82 100644 --- a/src/common/intrusive_red_black_tree.h +++ b/src/common/intrusive_red_black_tree.h | |||
| @@ -242,19 +242,21 @@ public: | |||
| 242 | 242 | ||
| 243 | template <typename T> | 243 | template <typename T> |
| 244 | concept HasRedBlackKeyType = requires { | 244 | concept HasRedBlackKeyType = requires { |
| 245 | { std::is_same<typename T::RedBlackKeyType, void>::value } -> std::convertible_to<bool>; | 245 | { |
| 246 | }; | 246 | std::is_same<typename T::RedBlackKeyType, void>::value |
| 247 | } -> std::convertible_to<bool>; | ||
| 248 | }; | ||
| 247 | 249 | ||
| 248 | namespace impl { | 250 | namespace impl { |
| 249 | 251 | ||
| 250 | template <typename T, typename Default> | 252 | template <typename T, typename Default> |
| 251 | consteval auto* GetRedBlackKeyType() { | 253 | consteval auto* GetRedBlackKeyType() { |
| 252 | if constexpr (HasRedBlackKeyType<T>) { | 254 | if constexpr (HasRedBlackKeyType<T>) { |
| 253 | return static_cast<typename T::RedBlackKeyType*>(nullptr); | 255 | return static_cast<typename T::RedBlackKeyType*>(nullptr); |
| 254 | } else { | 256 | } else { |
| 255 | return static_cast<Default*>(nullptr); | 257 | return static_cast<Default*>(nullptr); |
| 256 | } | ||
| 257 | } | 258 | } |
| 259 | } | ||
| 258 | 260 | ||
| 259 | } // namespace impl | 261 | } // namespace impl |
| 260 | 262 | ||
diff --git a/src/common/make_unique_for_overwrite.h b/src/common/make_unique_for_overwrite.h index c7413cf51..17f81bba4 100644 --- a/src/common/make_unique_for_overwrite.h +++ b/src/common/make_unique_for_overwrite.h | |||
| @@ -9,17 +9,19 @@ | |||
| 9 | namespace Common { | 9 | namespace Common { |
| 10 | 10 | ||
| 11 | template <class T> | 11 | template <class T> |
| 12 | requires(!std::is_array_v<T>) std::unique_ptr<T> make_unique_for_overwrite() { | 12 | requires(!std::is_array_v<T>) |
| 13 | std::unique_ptr<T> make_unique_for_overwrite() { | ||
| 13 | return std::unique_ptr<T>(new T); | 14 | return std::unique_ptr<T>(new T); |
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | template <class T> | 17 | template <class T> |
| 17 | requires std::is_unbounded_array_v<T> std::unique_ptr<T> make_unique_for_overwrite(std::size_t n) { | 18 | requires std::is_unbounded_array_v<T> |
| 19 | std::unique_ptr<T> make_unique_for_overwrite(std::size_t n) { | ||
| 18 | return std::unique_ptr<T>(new std::remove_extent_t<T>[n]); | 20 | return std::unique_ptr<T>(new std::remove_extent_t<T>[n]); |
| 19 | } | 21 | } |
| 20 | 22 | ||
| 21 | template <class T, class... Args> | 23 | template <class T, class... Args> |
| 22 | requires std::is_bounded_array_v<T> | 24 | requires std::is_bounded_array_v<T> |
| 23 | void make_unique_for_overwrite(Args&&...) = delete; | 25 | void make_unique_for_overwrite(Args&&...) = delete; |
| 24 | 26 | ||
| 25 | } // namespace Common | 27 | } // namespace Common |
diff --git a/src/common/polyfill_ranges.h b/src/common/polyfill_ranges.h index ca44bfaef..512dbcbcb 100644 --- a/src/common/polyfill_ranges.h +++ b/src/common/polyfill_ranges.h | |||
| @@ -18,9 +18,9 @@ namespace ranges { | |||
| 18 | 18 | ||
| 19 | template <typename T> | 19 | template <typename T> |
| 20 | concept range = requires(T& t) { | 20 | concept range = requires(T& t) { |
| 21 | begin(t); | 21 | begin(t); |
| 22 | end(t); | 22 | end(t); |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | template <typename T> | 25 | template <typename T> |
| 26 | concept input_range = range<T>; | 26 | concept input_range = range<T>; |
| @@ -421,7 +421,7 @@ struct generate_fn { | |||
| 421 | } | 421 | } |
| 422 | 422 | ||
| 423 | template <typename R, std::copy_constructible F> | 423 | template <typename R, std::copy_constructible F> |
| 424 | requires std::invocable<F&> && ranges::output_range<R> | 424 | requires std::invocable<F&> && ranges::output_range<R> |
| 425 | constexpr ranges::iterator_t<R> operator()(R&& r, F gen) const { | 425 | constexpr ranges::iterator_t<R> operator()(R&& r, F gen) const { |
| 426 | return operator()(ranges::begin(r), ranges::end(r), std::move(gen)); | 426 | return operator()(ranges::begin(r), ranges::end(r), std::move(gen)); |
| 427 | } | 427 | } |
diff --git a/src/common/polyfill_thread.h b/src/common/polyfill_thread.h index b4c94a5fc..b5ef055db 100644 --- a/src/common/polyfill_thread.h +++ b/src/common/polyfill_thread.h | |||
| @@ -213,7 +213,7 @@ public: | |||
| 213 | using callback_type = Callback; | 213 | using callback_type = Callback; |
| 214 | 214 | ||
| 215 | template <typename C> | 215 | template <typename C> |
| 216 | requires constructible_from<Callback, C> | 216 | requires constructible_from<Callback, C> |
| 217 | explicit stop_callback(const stop_token& st, | 217 | explicit stop_callback(const stop_token& st, |
| 218 | C&& cb) noexcept(is_nothrow_constructible_v<Callback, C>) | 218 | C&& cb) noexcept(is_nothrow_constructible_v<Callback, C>) |
| 219 | : m_stop_state(st.m_stop_state) { | 219 | : m_stop_state(st.m_stop_state) { |
| @@ -222,7 +222,7 @@ public: | |||
| 222 | } | 222 | } |
| 223 | } | 223 | } |
| 224 | template <typename C> | 224 | template <typename C> |
| 225 | requires constructible_from<Callback, C> | 225 | requires constructible_from<Callback, C> |
| 226 | explicit stop_callback(stop_token&& st, | 226 | explicit stop_callback(stop_token&& st, |
| 227 | C&& cb) noexcept(is_nothrow_constructible_v<Callback, C>) | 227 | C&& cb) noexcept(is_nothrow_constructible_v<Callback, C>) |
| 228 | : m_stop_state(move(st.m_stop_state)) { | 228 | : m_stop_state(move(st.m_stop_state)) { |
diff --git a/src/common/settings.h b/src/common/settings.h index 4b4da4da2..64db66f37 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -131,7 +131,8 @@ public: | |||
| 131 | * @param default_val Intial value of the setting, and default value of the setting | 131 | * @param default_val Intial value of the setting, and default value of the setting |
| 132 | * @param name Label for the setting | 132 | * @param name Label for the setting |
| 133 | */ | 133 | */ |
| 134 | explicit Setting(const Type& default_val, const std::string& name) requires(!ranged) | 134 | explicit Setting(const Type& default_val, const std::string& name) |
| 135 | requires(!ranged) | ||
| 135 | : value{default_val}, default_value{default_val}, label{name} {} | 136 | : value{default_val}, default_value{default_val}, label{name} {} |
| 136 | virtual ~Setting() = default; | 137 | virtual ~Setting() = default; |
| 137 | 138 | ||
| @@ -144,7 +145,8 @@ public: | |||
| 144 | * @param name Label for the setting | 145 | * @param name Label for the setting |
| 145 | */ | 146 | */ |
| 146 | explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, | 147 | explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, |
| 147 | const std::string& name) requires(ranged) | 148 | const std::string& name) |
| 149 | requires(ranged) | ||
| 148 | : value{default_val}, | 150 | : value{default_val}, |
| 149 | default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {} | 151 | default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {} |
| 150 | 152 | ||
| @@ -232,7 +234,8 @@ public: | |||
| 232 | * @param default_val Intial value of the setting, and default value of the setting | 234 | * @param default_val Intial value of the setting, and default value of the setting |
| 233 | * @param name Label for the setting | 235 | * @param name Label for the setting |
| 234 | */ | 236 | */ |
| 235 | explicit SwitchableSetting(const Type& default_val, const std::string& name) requires(!ranged) | 237 | explicit SwitchableSetting(const Type& default_val, const std::string& name) |
| 238 | requires(!ranged) | ||
| 236 | : Setting<Type>{default_val, name} {} | 239 | : Setting<Type>{default_val, name} {} |
| 237 | virtual ~SwitchableSetting() = default; | 240 | virtual ~SwitchableSetting() = default; |
| 238 | 241 | ||
| @@ -245,7 +248,8 @@ public: | |||
| 245 | * @param name Label for the setting | 248 | * @param name Label for the setting |
| 246 | */ | 249 | */ |
| 247 | explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val, | 250 | explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val, |
| 248 | const std::string& name) requires(ranged) | 251 | const std::string& name) |
| 252 | requires(ranged) | ||
| 249 | : Setting<Type, true>{default_val, min_val, max_val, name} {} | 253 | : Setting<Type, true>{default_val, min_val, max_val, name} {} |
| 250 | 254 | ||
| 251 | /** | 255 | /** |
diff --git a/src/common/tree.h b/src/common/tree.h index f77859209..f4fc43de3 100644 --- a/src/common/tree.h +++ b/src/common/tree.h | |||
| @@ -103,12 +103,12 @@ concept IsRBEntry = CheckRBEntry<T>::value; | |||
| 103 | 103 | ||
| 104 | template <typename T> | 104 | template <typename T> |
| 105 | concept HasRBEntry = requires(T& t, const T& ct) { | 105 | concept HasRBEntry = requires(T& t, const T& ct) { |
| 106 | { t.GetRBEntry() } -> std::same_as<RBEntry<T>&>; | 106 | { t.GetRBEntry() } -> std::same_as<RBEntry<T>&>; |
| 107 | { ct.GetRBEntry() } -> std::same_as<const RBEntry<T>&>; | 107 | { ct.GetRBEntry() } -> std::same_as<const RBEntry<T>&>; |
| 108 | }; | 108 | }; |
| 109 | 109 | ||
| 110 | template <typename T> | 110 | template <typename T> |
| 111 | requires HasRBEntry<T> | 111 | requires HasRBEntry<T> |
| 112 | class RBHead { | 112 | class RBHead { |
| 113 | private: | 113 | private: |
| 114 | T* m_rbh_root = nullptr; | 114 | T* m_rbh_root = nullptr; |
| @@ -130,90 +130,90 @@ public: | |||
| 130 | }; | 130 | }; |
| 131 | 131 | ||
| 132 | template <typename T> | 132 | template <typename T> |
| 133 | requires HasRBEntry<T> | 133 | requires HasRBEntry<T> |
| 134 | [[nodiscard]] constexpr RBEntry<T>& RB_ENTRY(T* t) { | 134 | [[nodiscard]] constexpr RBEntry<T>& RB_ENTRY(T* t) { |
| 135 | return t->GetRBEntry(); | 135 | return t->GetRBEntry(); |
| 136 | } | 136 | } |
| 137 | template <typename T> | 137 | template <typename T> |
| 138 | requires HasRBEntry<T> | 138 | requires HasRBEntry<T> |
| 139 | [[nodiscard]] constexpr const RBEntry<T>& RB_ENTRY(const T* t) { | 139 | [[nodiscard]] constexpr const RBEntry<T>& RB_ENTRY(const T* t) { |
| 140 | return t->GetRBEntry(); | 140 | return t->GetRBEntry(); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | template <typename T> | 143 | template <typename T> |
| 144 | requires HasRBEntry<T> | 144 | requires HasRBEntry<T> |
| 145 | [[nodiscard]] constexpr T* RB_LEFT(T* t) { | 145 | [[nodiscard]] constexpr T* RB_LEFT(T* t) { |
| 146 | return RB_ENTRY(t).Left(); | 146 | return RB_ENTRY(t).Left(); |
| 147 | } | 147 | } |
| 148 | template <typename T> | 148 | template <typename T> |
| 149 | requires HasRBEntry<T> | 149 | requires HasRBEntry<T> |
| 150 | [[nodiscard]] constexpr const T* RB_LEFT(const T* t) { | 150 | [[nodiscard]] constexpr const T* RB_LEFT(const T* t) { |
| 151 | return RB_ENTRY(t).Left(); | 151 | return RB_ENTRY(t).Left(); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | template <typename T> | 154 | template <typename T> |
| 155 | requires HasRBEntry<T> | 155 | requires HasRBEntry<T> |
| 156 | [[nodiscard]] constexpr T* RB_RIGHT(T* t) { | 156 | [[nodiscard]] constexpr T* RB_RIGHT(T* t) { |
| 157 | return RB_ENTRY(t).Right(); | 157 | return RB_ENTRY(t).Right(); |
| 158 | } | 158 | } |
| 159 | template <typename T> | 159 | template <typename T> |
| 160 | requires HasRBEntry<T> | 160 | requires HasRBEntry<T> |
| 161 | [[nodiscard]] constexpr const T* RB_RIGHT(const T* t) { | 161 | [[nodiscard]] constexpr const T* RB_RIGHT(const T* t) { |
| 162 | return RB_ENTRY(t).Right(); | 162 | return RB_ENTRY(t).Right(); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | template <typename T> | 165 | template <typename T> |
| 166 | requires HasRBEntry<T> | 166 | requires HasRBEntry<T> |
| 167 | [[nodiscard]] constexpr T* RB_PARENT(T* t) { | 167 | [[nodiscard]] constexpr T* RB_PARENT(T* t) { |
| 168 | return RB_ENTRY(t).Parent(); | 168 | return RB_ENTRY(t).Parent(); |
| 169 | } | 169 | } |
| 170 | template <typename T> | 170 | template <typename T> |
| 171 | requires HasRBEntry<T> | 171 | requires HasRBEntry<T> |
| 172 | [[nodiscard]] constexpr const T* RB_PARENT(const T* t) { | 172 | [[nodiscard]] constexpr const T* RB_PARENT(const T* t) { |
| 173 | return RB_ENTRY(t).Parent(); | 173 | return RB_ENTRY(t).Parent(); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | template <typename T> | 176 | template <typename T> |
| 177 | requires HasRBEntry<T> | 177 | requires HasRBEntry<T> |
| 178 | constexpr void RB_SET_LEFT(T* t, T* e) { | 178 | constexpr void RB_SET_LEFT(T* t, T* e) { |
| 179 | RB_ENTRY(t).SetLeft(e); | 179 | RB_ENTRY(t).SetLeft(e); |
| 180 | } | 180 | } |
| 181 | template <typename T> | 181 | template <typename T> |
| 182 | requires HasRBEntry<T> | 182 | requires HasRBEntry<T> |
| 183 | constexpr void RB_SET_RIGHT(T* t, T* e) { | 183 | constexpr void RB_SET_RIGHT(T* t, T* e) { |
| 184 | RB_ENTRY(t).SetRight(e); | 184 | RB_ENTRY(t).SetRight(e); |
| 185 | } | 185 | } |
| 186 | template <typename T> | 186 | template <typename T> |
| 187 | requires HasRBEntry<T> | 187 | requires HasRBEntry<T> |
| 188 | constexpr void RB_SET_PARENT(T* t, T* e) { | 188 | constexpr void RB_SET_PARENT(T* t, T* e) { |
| 189 | RB_ENTRY(t).SetParent(e); | 189 | RB_ENTRY(t).SetParent(e); |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | template <typename T> | 192 | template <typename T> |
| 193 | requires HasRBEntry<T> | 193 | requires HasRBEntry<T> |
| 194 | [[nodiscard]] constexpr bool RB_IS_BLACK(const T* t) { | 194 | [[nodiscard]] constexpr bool RB_IS_BLACK(const T* t) { |
| 195 | return RB_ENTRY(t).IsBlack(); | 195 | return RB_ENTRY(t).IsBlack(); |
| 196 | } | 196 | } |
| 197 | template <typename T> | 197 | template <typename T> |
| 198 | requires HasRBEntry<T> | 198 | requires HasRBEntry<T> |
| 199 | [[nodiscard]] constexpr bool RB_IS_RED(const T* t) { | 199 | [[nodiscard]] constexpr bool RB_IS_RED(const T* t) { |
| 200 | return RB_ENTRY(t).IsRed(); | 200 | return RB_ENTRY(t).IsRed(); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | template <typename T> | 203 | template <typename T> |
| 204 | requires HasRBEntry<T> | 204 | requires HasRBEntry<T> |
| 205 | [[nodiscard]] constexpr RBColor RB_COLOR(const T* t) { | 205 | [[nodiscard]] constexpr RBColor RB_COLOR(const T* t) { |
| 206 | return RB_ENTRY(t).Color(); | 206 | return RB_ENTRY(t).Color(); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | template <typename T> | 209 | template <typename T> |
| 210 | requires HasRBEntry<T> | 210 | requires HasRBEntry<T> |
| 211 | constexpr void RB_SET_COLOR(T* t, RBColor c) { | 211 | constexpr void RB_SET_COLOR(T* t, RBColor c) { |
| 212 | RB_ENTRY(t).SetColor(c); | 212 | RB_ENTRY(t).SetColor(c); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | template <typename T> | 215 | template <typename T> |
| 216 | requires HasRBEntry<T> | 216 | requires HasRBEntry<T> |
| 217 | constexpr void RB_SET(T* elm, T* parent) { | 217 | constexpr void RB_SET(T* elm, T* parent) { |
| 218 | auto& rb_entry = RB_ENTRY(elm); | 218 | auto& rb_entry = RB_ENTRY(elm); |
| 219 | rb_entry.SetParent(parent); | 219 | rb_entry.SetParent(parent); |
| @@ -223,14 +223,14 @@ constexpr void RB_SET(T* elm, T* parent) { | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | template <typename T> | 225 | template <typename T> |
| 226 | requires HasRBEntry<T> | 226 | requires HasRBEntry<T> |
| 227 | constexpr void RB_SET_BLACKRED(T* black, T* red) { | 227 | constexpr void RB_SET_BLACKRED(T* black, T* red) { |
| 228 | RB_SET_COLOR(black, RBColor::RB_BLACK); | 228 | RB_SET_COLOR(black, RBColor::RB_BLACK); |
| 229 | RB_SET_COLOR(red, RBColor::RB_RED); | 229 | RB_SET_COLOR(red, RBColor::RB_RED); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | template <typename T> | 232 | template <typename T> |
| 233 | requires HasRBEntry<T> | 233 | requires HasRBEntry<T> |
| 234 | constexpr void RB_ROTATE_LEFT(RBHead<T>& head, T* elm, T*& tmp) { | 234 | constexpr void RB_ROTATE_LEFT(RBHead<T>& head, T* elm, T*& tmp) { |
| 235 | tmp = RB_RIGHT(elm); | 235 | tmp = RB_RIGHT(elm); |
| 236 | if (RB_SET_RIGHT(elm, RB_LEFT(tmp)); RB_RIGHT(elm) != nullptr) { | 236 | if (RB_SET_RIGHT(elm, RB_LEFT(tmp)); RB_RIGHT(elm) != nullptr) { |
| @@ -252,7 +252,7 @@ constexpr void RB_ROTATE_LEFT(RBHead<T>& head, T* elm, T*& tmp) { | |||
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | template <typename T> | 254 | template <typename T> |
| 255 | requires HasRBEntry<T> | 255 | requires HasRBEntry<T> |
| 256 | constexpr void RB_ROTATE_RIGHT(RBHead<T>& head, T* elm, T*& tmp) { | 256 | constexpr void RB_ROTATE_RIGHT(RBHead<T>& head, T* elm, T*& tmp) { |
| 257 | tmp = RB_LEFT(elm); | 257 | tmp = RB_LEFT(elm); |
| 258 | if (RB_SET_LEFT(elm, RB_RIGHT(tmp)); RB_LEFT(elm) != nullptr) { | 258 | if (RB_SET_LEFT(elm, RB_RIGHT(tmp)); RB_LEFT(elm) != nullptr) { |
| @@ -274,7 +274,7 @@ constexpr void RB_ROTATE_RIGHT(RBHead<T>& head, T* elm, T*& tmp) { | |||
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | template <typename T> | 276 | template <typename T> |
| 277 | requires HasRBEntry<T> | 277 | requires HasRBEntry<T> |
| 278 | constexpr void RB_REMOVE_COLOR(RBHead<T>& head, T* parent, T* elm) { | 278 | constexpr void RB_REMOVE_COLOR(RBHead<T>& head, T* parent, T* elm) { |
| 279 | T* tmp; | 279 | T* tmp; |
| 280 | while ((elm == nullptr || RB_IS_BLACK(elm)) && elm != head.Root()) { | 280 | while ((elm == nullptr || RB_IS_BLACK(elm)) && elm != head.Root()) { |
| @@ -358,7 +358,7 @@ constexpr void RB_REMOVE_COLOR(RBHead<T>& head, T* parent, T* elm) { | |||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | template <typename T> | 360 | template <typename T> |
| 361 | requires HasRBEntry<T> | 361 | requires HasRBEntry<T> |
| 362 | constexpr T* RB_REMOVE(RBHead<T>& head, T* elm) { | 362 | constexpr T* RB_REMOVE(RBHead<T>& head, T* elm) { |
| 363 | T* child = nullptr; | 363 | T* child = nullptr; |
| 364 | T* parent = nullptr; | 364 | T* parent = nullptr; |
| @@ -451,7 +451,7 @@ constexpr T* RB_REMOVE(RBHead<T>& head, T* elm) { | |||
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | template <typename T> | 453 | template <typename T> |
| 454 | requires HasRBEntry<T> | 454 | requires HasRBEntry<T> |
| 455 | constexpr void RB_INSERT_COLOR(RBHead<T>& head, T* elm) { | 455 | constexpr void RB_INSERT_COLOR(RBHead<T>& head, T* elm) { |
| 456 | T *parent = nullptr, *tmp = nullptr; | 456 | T *parent = nullptr, *tmp = nullptr; |
| 457 | while ((parent = RB_PARENT(elm)) != nullptr && RB_IS_RED(parent)) { | 457 | while ((parent = RB_PARENT(elm)) != nullptr && RB_IS_RED(parent)) { |
| @@ -499,7 +499,7 @@ constexpr void RB_INSERT_COLOR(RBHead<T>& head, T* elm) { | |||
| 499 | } | 499 | } |
| 500 | 500 | ||
| 501 | template <typename T, typename Compare> | 501 | template <typename T, typename Compare> |
| 502 | requires HasRBEntry<T> | 502 | requires HasRBEntry<T> |
| 503 | constexpr T* RB_INSERT(RBHead<T>& head, T* elm, Compare cmp) { | 503 | constexpr T* RB_INSERT(RBHead<T>& head, T* elm, Compare cmp) { |
| 504 | T* parent = nullptr; | 504 | T* parent = nullptr; |
| 505 | T* tmp = head.Root(); | 505 | T* tmp = head.Root(); |
| @@ -534,7 +534,7 @@ constexpr T* RB_INSERT(RBHead<T>& head, T* elm, Compare cmp) { | |||
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | template <typename T, typename Compare> | 536 | template <typename T, typename Compare> |
| 537 | requires HasRBEntry<T> | 537 | requires HasRBEntry<T> |
| 538 | constexpr T* RB_FIND(RBHead<T>& head, T* elm, Compare cmp) { | 538 | constexpr T* RB_FIND(RBHead<T>& head, T* elm, Compare cmp) { |
| 539 | T* tmp = head.Root(); | 539 | T* tmp = head.Root(); |
| 540 | 540 | ||
| @@ -553,7 +553,7 @@ constexpr T* RB_FIND(RBHead<T>& head, T* elm, Compare cmp) { | |||
| 553 | } | 553 | } |
| 554 | 554 | ||
| 555 | template <typename T, typename Compare> | 555 | template <typename T, typename Compare> |
| 556 | requires HasRBEntry<T> | 556 | requires HasRBEntry<T> |
| 557 | constexpr T* RB_NFIND(RBHead<T>& head, T* elm, Compare cmp) { | 557 | constexpr T* RB_NFIND(RBHead<T>& head, T* elm, Compare cmp) { |
| 558 | T* tmp = head.Root(); | 558 | T* tmp = head.Root(); |
| 559 | T* res = nullptr; | 559 | T* res = nullptr; |
| @@ -574,7 +574,7 @@ constexpr T* RB_NFIND(RBHead<T>& head, T* elm, Compare cmp) { | |||
| 574 | } | 574 | } |
| 575 | 575 | ||
| 576 | template <typename T, typename U, typename Compare> | 576 | template <typename T, typename U, typename Compare> |
| 577 | requires HasRBEntry<T> | 577 | requires HasRBEntry<T> |
| 578 | constexpr T* RB_FIND_KEY(RBHead<T>& head, const U& key, Compare cmp) { | 578 | constexpr T* RB_FIND_KEY(RBHead<T>& head, const U& key, Compare cmp) { |
| 579 | T* tmp = head.Root(); | 579 | T* tmp = head.Root(); |
| 580 | 580 | ||
| @@ -593,7 +593,7 @@ constexpr T* RB_FIND_KEY(RBHead<T>& head, const U& key, Compare cmp) { | |||
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | template <typename T, typename U, typename Compare> | 595 | template <typename T, typename U, typename Compare> |
| 596 | requires HasRBEntry<T> | 596 | requires HasRBEntry<T> |
| 597 | constexpr T* RB_NFIND_KEY(RBHead<T>& head, const U& key, Compare cmp) { | 597 | constexpr T* RB_NFIND_KEY(RBHead<T>& head, const U& key, Compare cmp) { |
| 598 | T* tmp = head.Root(); | 598 | T* tmp = head.Root(); |
| 599 | T* res = nullptr; | 599 | T* res = nullptr; |
| @@ -614,7 +614,7 @@ constexpr T* RB_NFIND_KEY(RBHead<T>& head, const U& key, Compare cmp) { | |||
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | template <typename T, typename Compare> | 616 | template <typename T, typename Compare> |
| 617 | requires HasRBEntry<T> | 617 | requires HasRBEntry<T> |
| 618 | constexpr T* RB_FIND_EXISTING(RBHead<T>& head, T* elm, Compare cmp) { | 618 | constexpr T* RB_FIND_EXISTING(RBHead<T>& head, T* elm, Compare cmp) { |
| 619 | T* tmp = head.Root(); | 619 | T* tmp = head.Root(); |
| 620 | 620 | ||
| @@ -631,7 +631,7 @@ constexpr T* RB_FIND_EXISTING(RBHead<T>& head, T* elm, Compare cmp) { | |||
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | template <typename T, typename U, typename Compare> | 633 | template <typename T, typename U, typename Compare> |
| 634 | requires HasRBEntry<T> | 634 | requires HasRBEntry<T> |
| 635 | constexpr T* RB_FIND_EXISTING_KEY(RBHead<T>& head, const U& key, Compare cmp) { | 635 | constexpr T* RB_FIND_EXISTING_KEY(RBHead<T>& head, const U& key, Compare cmp) { |
| 636 | T* tmp = head.Root(); | 636 | T* tmp = head.Root(); |
| 637 | 637 | ||
| @@ -648,7 +648,7 @@ constexpr T* RB_FIND_EXISTING_KEY(RBHead<T>& head, const U& key, Compare cmp) { | |||
| 648 | } | 648 | } |
| 649 | 649 | ||
| 650 | template <typename T> | 650 | template <typename T> |
| 651 | requires HasRBEntry<T> | 651 | requires HasRBEntry<T> |
| 652 | constexpr T* RB_NEXT(T* elm) { | 652 | constexpr T* RB_NEXT(T* elm) { |
| 653 | if (RB_RIGHT(elm)) { | 653 | if (RB_RIGHT(elm)) { |
| 654 | elm = RB_RIGHT(elm); | 654 | elm = RB_RIGHT(elm); |
| @@ -669,7 +669,7 @@ constexpr T* RB_NEXT(T* elm) { | |||
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | template <typename T> | 671 | template <typename T> |
| 672 | requires HasRBEntry<T> | 672 | requires HasRBEntry<T> |
| 673 | constexpr T* RB_PREV(T* elm) { | 673 | constexpr T* RB_PREV(T* elm) { |
| 674 | if (RB_LEFT(elm)) { | 674 | if (RB_LEFT(elm)) { |
| 675 | elm = RB_LEFT(elm); | 675 | elm = RB_LEFT(elm); |
| @@ -690,7 +690,7 @@ constexpr T* RB_PREV(T* elm) { | |||
| 690 | } | 690 | } |
| 691 | 691 | ||
| 692 | template <typename T> | 692 | template <typename T> |
| 693 | requires HasRBEntry<T> | 693 | requires HasRBEntry<T> |
| 694 | constexpr T* RB_MIN(RBHead<T>& head) { | 694 | constexpr T* RB_MIN(RBHead<T>& head) { |
| 695 | T* tmp = head.Root(); | 695 | T* tmp = head.Root(); |
| 696 | T* parent = nullptr; | 696 | T* parent = nullptr; |
| @@ -704,7 +704,7 @@ constexpr T* RB_MIN(RBHead<T>& head) { | |||
| 704 | } | 704 | } |
| 705 | 705 | ||
| 706 | template <typename T> | 706 | template <typename T> |
| 707 | requires HasRBEntry<T> | 707 | requires HasRBEntry<T> |
| 708 | constexpr T* RB_MAX(RBHead<T>& head) { | 708 | constexpr T* RB_MAX(RBHead<T>& head) { |
| 709 | T* tmp = head.Root(); | 709 | T* tmp = head.Root(); |
| 710 | T* parent = nullptr; | 710 | T* parent = nullptr; |
diff --git a/src/common/vector_math.h b/src/common/vector_math.h index e62eeea2e..0e2095c45 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h | |||
| @@ -348,9 +348,7 @@ public: | |||
| 348 | // _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all | 348 | // _DEFINE_SWIZZLER2 defines a single such function, DEFINE_SWIZZLER2 defines all of them for all |
| 349 | // component names (x<->r) and permutations (xy<->yx) | 349 | // component names (x<->r) and permutations (xy<->yx) |
| 350 | #define _DEFINE_SWIZZLER2(a, b, name) \ | 350 | #define _DEFINE_SWIZZLER2(a, b, name) \ |
| 351 | [[nodiscard]] constexpr Vec2<T> name() const { \ | 351 | [[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); } |
| 352 | return Vec2<T>(a, b); \ | ||
| 353 | } | ||
| 354 | #define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \ | 352 | #define DEFINE_SWIZZLER2(a, b, a2, b2, a3, b3, a4, b4) \ |
| 355 | _DEFINE_SWIZZLER2(a, b, a##b); \ | 353 | _DEFINE_SWIZZLER2(a, b, a##b); \ |
| 356 | _DEFINE_SWIZZLER2(a, b, a2##b2); \ | 354 | _DEFINE_SWIZZLER2(a, b, a2##b2); \ |
| @@ -543,9 +541,7 @@ public: | |||
| 543 | // DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and | 541 | // DEFINE_SWIZZLER2_COMP2 defines two component functions for all component names (x<->r) and |
| 544 | // permutations (xy<->yx) | 542 | // permutations (xy<->yx) |
| 545 | #define _DEFINE_SWIZZLER2(a, b, name) \ | 543 | #define _DEFINE_SWIZZLER2(a, b, name) \ |
| 546 | [[nodiscard]] constexpr Vec2<T> name() const { \ | 544 | [[nodiscard]] constexpr Vec2<T> name() const { return Vec2<T>(a, b); } |
| 547 | return Vec2<T>(a, b); \ | ||
| 548 | } | ||
| 549 | #define DEFINE_SWIZZLER2_COMP1(a, a2) \ | 545 | #define DEFINE_SWIZZLER2_COMP1(a, a2) \ |
| 550 | _DEFINE_SWIZZLER2(a, a, a##a); \ | 546 | _DEFINE_SWIZZLER2(a, a, a##a); \ |
| 551 | _DEFINE_SWIZZLER2(a, a, a2##a2) | 547 | _DEFINE_SWIZZLER2(a, a, a2##a2) |
| @@ -570,9 +566,7 @@ public: | |||
| 570 | #undef _DEFINE_SWIZZLER2 | 566 | #undef _DEFINE_SWIZZLER2 |
| 571 | 567 | ||
| 572 | #define _DEFINE_SWIZZLER3(a, b, c, name) \ | 568 | #define _DEFINE_SWIZZLER3(a, b, c, name) \ |
| 573 | [[nodiscard]] constexpr Vec3<T> name() const { \ | 569 | [[nodiscard]] constexpr Vec3<T> name() const { return Vec3<T>(a, b, c); } |
| 574 | return Vec3<T>(a, b, c); \ | ||
| 575 | } | ||
| 576 | #define DEFINE_SWIZZLER3_COMP1(a, a2) \ | 570 | #define DEFINE_SWIZZLER3_COMP1(a, a2) \ |
| 577 | _DEFINE_SWIZZLER3(a, a, a, a##a##a); \ | 571 | _DEFINE_SWIZZLER3(a, a, a, a##a##a); \ |
| 578 | _DEFINE_SWIZZLER3(a, a, a, a2##a2##a2) | 572 | _DEFINE_SWIZZLER3(a, a, a, a2##a2##a2) |
| @@ -641,8 +635,8 @@ template <typename T> | |||
| 641 | 635 | ||
| 642 | // linear interpolation via float: 0.0=begin, 1.0=end | 636 | // linear interpolation via float: 0.0=begin, 1.0=end |
| 643 | template <typename X> | 637 | template <typename X> |
| 644 | [[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) | 638 | [[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end, |
| 645 | Lerp(const X& begin, const X& end, const float t) { | 639 | const float t) { |
| 646 | return begin * (1.f - t) + end * t; | 640 | return begin * (1.f - t) + end * t; |
| 647 | } | 641 | } |
| 648 | 642 | ||
diff --git a/src/core/hle/kernel/k_auto_object.h b/src/core/hle/kernel/k_auto_object.h index 2827763d5..e8118c2b8 100644 --- a/src/core/hle/kernel/k_auto_object.h +++ b/src/core/hle/kernel/k_auto_object.h | |||
| @@ -24,9 +24,7 @@ private: | |||
| 24 | friend class ::Kernel::KClassTokenGenerator; \ | 24 | friend class ::Kernel::KClassTokenGenerator; \ |
| 25 | static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \ | 25 | static constexpr inline auto ObjectType = ::Kernel::KClassTokenGenerator::ObjectType::CLASS; \ |
| 26 | static constexpr inline const char* const TypeName = #CLASS; \ | 26 | static constexpr inline const char* const TypeName = #CLASS; \ |
| 27 | static constexpr inline ClassTokenType ClassToken() { \ | 27 | static constexpr inline ClassTokenType ClassToken() { return ::Kernel::ClassToken<CLASS>; } \ |
| 28 | return ::Kernel::ClassToken<CLASS>; \ | ||
| 29 | } \ | ||
| 30 | \ | 28 | \ |
| 31 | public: \ | 29 | public: \ |
| 32 | YUZU_NON_COPYABLE(CLASS); \ | 30 | YUZU_NON_COPYABLE(CLASS); \ |
| @@ -37,15 +35,9 @@ public: | |||
| 37 | constexpr ClassTokenType Token = ClassToken(); \ | 35 | constexpr ClassTokenType Token = ClassToken(); \ |
| 38 | return TypeObj(TypeName, Token); \ | 36 | return TypeObj(TypeName, Token); \ |
| 39 | } \ | 37 | } \ |
| 40 | static constexpr const char* GetStaticTypeName() { \ | 38 | static constexpr const char* GetStaticTypeName() { return TypeName; } \ |
| 41 | return TypeName; \ | 39 | virtual TypeObj GetTypeObj() ATTRIBUTE { return GetStaticTypeObj(); } \ |
| 42 | } \ | 40 | virtual const char* GetTypeName() ATTRIBUTE { return GetStaticTypeName(); } \ |
| 43 | virtual TypeObj GetTypeObj() ATTRIBUTE { \ | ||
| 44 | return GetStaticTypeObj(); \ | ||
| 45 | } \ | ||
| 46 | virtual const char* GetTypeName() ATTRIBUTE { \ | ||
| 47 | return GetStaticTypeName(); \ | ||
| 48 | } \ | ||
| 49 | \ | 41 | \ |
| 50 | private: \ | 42 | private: \ |
| 51 | constexpr bool operator!=(const TypeObj& rhs) | 43 | constexpr bool operator!=(const TypeObj& rhs) |
| @@ -245,8 +237,8 @@ public: | |||
| 245 | } | 237 | } |
| 246 | 238 | ||
| 247 | template <typename U> | 239 | template <typename U> |
| 248 | requires(std::derived_from<T, U> || | 240 | requires(std::derived_from<T, U> || std::derived_from<U, T>) |
| 249 | std::derived_from<U, T>) constexpr KScopedAutoObject(KScopedAutoObject<U>&& rhs) { | 241 | constexpr KScopedAutoObject(KScopedAutoObject<U>&& rhs) { |
| 250 | if constexpr (std::derived_from<U, T>) { | 242 | if constexpr (std::derived_from<U, T>) { |
| 251 | // Upcast. | 243 | // Upcast. |
| 252 | m_obj = rhs.m_obj; | 244 | m_obj = rhs.m_obj; |
diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index cb2512b0b..645c5b531 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h | |||
| @@ -17,35 +17,41 @@ namespace Kernel { | |||
| 17 | class KThread; | 17 | class KThread; |
| 18 | 18 | ||
| 19 | template <typename T> | 19 | template <typename T> |
| 20 | concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t) { | 20 | concept KPriorityQueueAffinityMask = ! |
| 21 | { t.GetAffinityMask() } -> Common::ConvertibleTo<u64>; | 21 | std::is_reference_v<T>&& requires(T& t) { |
| 22 | {t.SetAffinityMask(0)}; | 22 | { t.GetAffinityMask() } -> Common::ConvertibleTo<u64>; |
| 23 | { t.SetAffinityMask(0) }; | ||
| 23 | 24 | ||
| 24 | { t.GetAffinity(0) } -> std::same_as<bool>; | 25 | { t.GetAffinity(0) } -> std::same_as<bool>; |
| 25 | {t.SetAffinity(0, false)}; | 26 | { t.SetAffinity(0, false) }; |
| 26 | {t.SetAll()}; | 27 | { t.SetAll() }; |
| 27 | }; | 28 | }; |
| 28 | 29 | ||
| 29 | template <typename T> | 30 | template <typename T> |
| 30 | concept KPriorityQueueMember = !std::is_reference_v<T> && requires(T & t) { | 31 | concept KPriorityQueueMember = ! |
| 31 | {typename T::QueueEntry()}; | 32 | std::is_reference_v<T>&& requires(T& t) { |
| 32 | {(typename T::QueueEntry()).Initialize()}; | 33 | { typename T::QueueEntry() }; |
| 33 | {(typename T::QueueEntry()).SetPrev(std::addressof(t))}; | 34 | { (typename T::QueueEntry()).Initialize() }; |
| 34 | {(typename T::QueueEntry()).SetNext(std::addressof(t))}; | 35 | { (typename T::QueueEntry()).SetPrev(std::addressof(t)) }; |
| 35 | { (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>; | 36 | { (typename T::QueueEntry()).SetNext(std::addressof(t)) }; |
| 36 | { (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>; | 37 | { (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>; |
| 37 | { t.GetPriorityQueueEntry(0) } -> std::same_as<typename T::QueueEntry&>; | 38 | { (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>; |
| 38 | 39 | { | |
| 39 | {t.GetAffinityMask()}; | 40 | t.GetPriorityQueueEntry(0) |
| 40 | { std::remove_cvref_t<decltype(t.GetAffinityMask())>() } -> KPriorityQueueAffinityMask; | 41 | } -> std::same_as<typename T::QueueEntry&>; |
| 41 | 42 | ||
| 42 | { t.GetActiveCore() } -> Common::ConvertibleTo<s32>; | 43 | { t.GetAffinityMask() }; |
| 43 | { t.GetPriority() } -> Common::ConvertibleTo<s32>; | 44 | { |
| 44 | { t.IsDummyThread() } -> Common::ConvertibleTo<bool>; | 45 | std::remove_cvref_t<decltype(t.GetAffinityMask())>() |
| 45 | }; | 46 | } -> KPriorityQueueAffinityMask; |
| 47 | |||
| 48 | { t.GetActiveCore() } -> Common::ConvertibleTo<s32>; | ||
| 49 | { t.GetPriority() } -> Common::ConvertibleTo<s32>; | ||
| 50 | { t.IsDummyThread() } -> Common::ConvertibleTo<bool>; | ||
| 51 | }; | ||
| 46 | 52 | ||
| 47 | template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority> | 53 | template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority> |
| 48 | requires KPriorityQueueMember<Member> | 54 | requires KPriorityQueueMember<Member> |
| 49 | class KPriorityQueue { | 55 | class KPriorityQueue { |
| 50 | public: | 56 | public: |
| 51 | using AffinityMaskType = std::remove_cv_t< | 57 | using AffinityMaskType = std::remove_cv_t< |
diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h index 857e21156..59b3e32ae 100644 --- a/src/core/hle/kernel/k_scoped_lock.h +++ b/src/core/hle/kernel/k_scoped_lock.h | |||
| @@ -9,13 +9,14 @@ | |||
| 9 | namespace Kernel { | 9 | namespace Kernel { |
| 10 | 10 | ||
| 11 | template <typename T> | 11 | template <typename T> |
| 12 | concept KLockable = !std::is_reference_v<T> && requires(T & t) { | 12 | concept KLockable = ! |
| 13 | { t.Lock() } -> std::same_as<void>; | 13 | std::is_reference_v<T>&& requires(T& t) { |
| 14 | { t.Unlock() } -> std::same_as<void>; | 14 | { t.Lock() } -> std::same_as<void>; |
| 15 | }; | 15 | { t.Unlock() } -> std::same_as<void>; |
| 16 | }; | ||
| 16 | 17 | ||
| 17 | template <typename T> | 18 | template <typename T> |
| 18 | requires KLockable<T> | 19 | requires KLockable<T> |
| 19 | class [[nodiscard]] KScopedLock { | 20 | class [[nodiscard]] KScopedLock { |
| 20 | public: | 21 | public: |
| 21 | explicit KScopedLock(T* l) : lock_ptr(l) { | 22 | explicit KScopedLock(T* l) : lock_ptr(l) { |
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index 9d771de0e..8b8dc51be 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h | |||
| @@ -677,7 +677,7 @@ private: | |||
| 677 | union SyncObjectBuffer { | 677 | union SyncObjectBuffer { |
| 678 | std::array<KSynchronizationObject*, Svc::ArgumentHandleCountMax> sync_objects{}; | 678 | std::array<KSynchronizationObject*, Svc::ArgumentHandleCountMax> sync_objects{}; |
| 679 | std::array<Handle, | 679 | std::array<Handle, |
| 680 | Svc::ArgumentHandleCountMax*(sizeof(KSynchronizationObject*) / sizeof(Handle))> | 680 | Svc::ArgumentHandleCountMax * (sizeof(KSynchronizationObject*) / sizeof(Handle))> |
| 681 | handles; | 681 | handles; |
| 682 | constexpr SyncObjectBuffer() {} | 682 | constexpr SyncObjectBuffer() {} |
| 683 | }; | 683 | }; |
| @@ -698,10 +698,8 @@ private: | |||
| 698 | }; | 698 | }; |
| 699 | 699 | ||
| 700 | template <typename T> | 700 | template <typename T> |
| 701 | requires( | 701 | requires(std::same_as<T, KThread> || std::same_as<T, RedBlackKeyType>) |
| 702 | std::same_as<T, KThread> || | 702 | static constexpr int Compare(const T& lhs, const KThread& rhs) { |
| 703 | std::same_as<T, RedBlackKeyType>) static constexpr int Compare(const T& lhs, | ||
| 704 | const KThread& rhs) { | ||
| 705 | const u64 l_key = lhs.GetConditionVariableKey(); | 703 | const u64 l_key = lhs.GetConditionVariableKey(); |
| 706 | const u64 r_key = rhs.GetConditionVariableKey(); | 704 | const u64 r_key = rhs.GetConditionVariableKey(); |
| 707 | 705 | ||
diff --git a/src/core/hle/kernel/k_thread_local_page.h b/src/core/hle/kernel/k_thread_local_page.h index fe0cff084..71254eb55 100644 --- a/src/core/hle/kernel/k_thread_local_page.h +++ b/src/core/hle/kernel/k_thread_local_page.h | |||
| @@ -70,10 +70,8 @@ public: | |||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | template <typename T> | 72 | template <typename T> |
| 73 | requires(std::same_as<T, KThreadLocalPage> || | 73 | requires(std::same_as<T, KThreadLocalPage> || std::same_as<T, RedBlackKeyType>) |
| 74 | std::same_as<T, RedBlackKeyType>) static constexpr int Compare(const T& lhs, | 74 | static constexpr int Compare(const T& lhs, const KThreadLocalPage& rhs) { |
| 75 | const KThreadLocalPage& | ||
| 76 | rhs) { | ||
| 77 | const VAddr lval = GetRedBlackKey(lhs); | 75 | const VAddr lval = GetRedBlackKey(lhs); |
| 78 | const VAddr rval = GetRedBlackKey(rhs); | 76 | const VAddr rval = GetRedBlackKey(rhs); |
| 79 | 77 | ||
diff --git a/src/input_common/helpers/joycon_protocol/common_protocol.h b/src/input_common/helpers/joycon_protocol/common_protocol.h index 75d3f20a4..188f6ecfa 100644 --- a/src/input_common/helpers/joycon_protocol/common_protocol.h +++ b/src/input_common/helpers/joycon_protocol/common_protocol.h | |||
| @@ -107,8 +107,8 @@ public: | |||
| 107 | * @returns output object containing the responce | 107 | * @returns output object containing the responce |
| 108 | */ | 108 | */ |
| 109 | template <typename Output> | 109 | template <typename Output> |
| 110 | requires std::is_trivially_copyable_v<Output> DriverResult ReadSPI(SpiAddress addr, | 110 | requires std::is_trivially_copyable_v<Output> |
| 111 | Output& output) { | 111 | DriverResult ReadSPI(SpiAddress addr, Output& output) { |
| 112 | std::array<u8, sizeof(Output)> buffer; | 112 | std::array<u8, sizeof(Output)> buffer; |
| 113 | output = {}; | 113 | output = {}; |
| 114 | 114 | ||
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index df158c928..f3c81dbe1 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -409,7 +409,8 @@ private: | |||
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | template <typename T> | 411 | template <typename T> |
| 412 | requires(sizeof(T) <= sizeof(u32) && std::is_trivially_copyable_v<T>) struct Flags { | 412 | requires(sizeof(T) <= sizeof(u32) && std::is_trivially_copyable_v<T>) |
| 413 | struct Flags { | ||
| 413 | Flags() = default; | 414 | Flags() = default; |
| 414 | Flags(T proxy_) : proxy{proxy_} {} | 415 | Flags(T proxy_) : proxy{proxy_} {} |
| 415 | 416 | ||
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index 883dfa24e..22e89dd1b 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h | |||
| @@ -101,9 +101,8 @@ public: | |||
| 101 | TypedValue() = default; | 101 | TypedValue() = default; |
| 102 | 102 | ||
| 103 | template <IR::Type other_type> | 103 | template <IR::Type other_type> |
| 104 | requires((other_type & type_) != IR::Type::Void) explicit(false) | 104 | requires((other_type & type_) != IR::Type::Void) |
| 105 | TypedValue(const TypedValue<other_type>& value) | 105 | explicit(false) TypedValue(const TypedValue<other_type>& value) : Value(value) {} |
| 106 | : Value(value) {} | ||
| 107 | 106 | ||
| 108 | explicit TypedValue(const Value& value) : Value(value) { | 107 | explicit TypedValue(const Value& value) : Value(value) { |
| 109 | if ((value.Type() & type_) == IR::Type::Void) { | 108 | if ((value.Type() & type_) == IR::Type::Void) { |
| @@ -194,16 +193,16 @@ public: | |||
| 194 | void ReplaceOpcode(IR::Opcode opcode); | 193 | void ReplaceOpcode(IR::Opcode opcode); |
| 195 | 194 | ||
| 196 | template <typename FlagsType> | 195 | template <typename FlagsType> |
| 197 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) | 196 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) |
| 198 | [[nodiscard]] FlagsType Flags() const noexcept { | 197 | [[nodiscard]] FlagsType Flags() const noexcept { |
| 199 | FlagsType ret; | 198 | FlagsType ret; |
| 200 | std::memcpy(reinterpret_cast<char*>(&ret), &flags, sizeof(ret)); | 199 | std::memcpy(reinterpret_cast<char*>(&ret), &flags, sizeof(ret)); |
| 201 | return ret; | 200 | return ret; |
| 202 | } | 201 | } |
| 203 | 202 | ||
| 204 | template <typename FlagsType> | 203 | template <typename FlagsType> |
| 205 | requires(sizeof(FlagsType) <= sizeof(u32) && | 204 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) |
| 206 | std::is_trivially_copyable_v<FlagsType>) void SetFlags(FlagsType value) noexcept { | 205 | void SetFlags(FlagsType value) noexcept { |
| 207 | std::memcpy(&flags, &value, sizeof(value)); | 206 | std::memcpy(&flags, &value, sizeof(value)); |
| 208 | } | 207 | } |
| 209 | 208 | ||
diff --git a/src/shader_recompiler/object_pool.h b/src/shader_recompiler/object_pool.h index 2b42c4ba2..5d648b159 100644 --- a/src/shader_recompiler/object_pool.h +++ b/src/shader_recompiler/object_pool.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | namespace Shader { | 10 | namespace Shader { |
| 11 | 11 | ||
| 12 | template <typename T> | 12 | template <typename T> |
| 13 | requires std::is_destructible_v<T> | 13 | requires std::is_destructible_v<T> |
| 14 | class ObjectPool { | 14 | class ObjectPool { |
| 15 | public: | 15 | public: |
| 16 | explicit ObjectPool(size_t chunk_size = 8192) : new_chunk_size{chunk_size} { | 16 | explicit ObjectPool(size_t chunk_size = 8192) : new_chunk_size{chunk_size} { |
| @@ -18,7 +18,7 @@ public: | |||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | template <typename... Args> | 20 | template <typename... Args> |
| 21 | requires std::is_constructible_v<T, Args...> | 21 | requires std::is_constructible_v<T, Args...> |
| 22 | [[nodiscard]] T* Create(Args&&... args) { | 22 | [[nodiscard]] T* Create(Args&&... args) { |
| 23 | return std::construct_at(Memory(), std::forward<Args>(args)...); | 23 | return std::construct_at(Memory(), std::forward<Args>(args)...); |
| 24 | } | 24 | } |
diff --git a/src/video_core/texture_cache/descriptor_table.h b/src/video_core/texture_cache/descriptor_table.h index ee4240288..1bad83fb4 100644 --- a/src/video_core/texture_cache/descriptor_table.h +++ b/src/video_core/texture_cache/descriptor_table.h | |||
| @@ -19,9 +19,7 @@ public: | |||
| 19 | explicit DescriptorTable(Tegra::MemoryManager& gpu_memory_) : gpu_memory{gpu_memory_} {} | 19 | explicit DescriptorTable(Tegra::MemoryManager& gpu_memory_) : gpu_memory{gpu_memory_} {} |
| 20 | 20 | ||
| 21 | [[nodiscard]] bool Synchronize(GPUVAddr gpu_addr, u32 limit) { | 21 | [[nodiscard]] bool Synchronize(GPUVAddr gpu_addr, u32 limit) { |
| 22 | [[likely]] if (current_gpu_addr == gpu_addr && current_limit == limit) { | 22 | [[likely]] if (current_gpu_addr == gpu_addr && current_limit == limit) { return false; } |
| 23 | return false; | ||
| 24 | } | ||
| 25 | Refresh(gpu_addr, limit); | 23 | Refresh(gpu_addr, limit); |
| 26 | return true; | 24 | return true; |
| 27 | } | 25 | } |
diff --git a/src/video_core/texture_cache/slot_vector.h b/src/video_core/texture_cache/slot_vector.h index 1e2aad76a..9df6a2903 100644 --- a/src/video_core/texture_cache/slot_vector.h +++ b/src/video_core/texture_cache/slot_vector.h | |||
| @@ -29,7 +29,7 @@ struct SlotId { | |||
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | template <class T> | 31 | template <class T> |
| 32 | requires std::is_nothrow_move_assignable_v<T> && std::is_nothrow_move_constructible_v<T> | 32 | requires std::is_nothrow_move_assignable_v<T> && std::is_nothrow_move_constructible_v<T> |
| 33 | class SlotVector { | 33 | class SlotVector { |
| 34 | public: | 34 | public: |
| 35 | class Iterator { | 35 | class Iterator { |