diff options
| -rw-r--r-- | src/common/concepts.h | 23 | ||||
| -rw-r--r-- | src/common/fixed_point.h | 15 | ||||
| -rw-r--r-- | src/core/file_sys/fs_path_utility.h | 6 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_priority_queue.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm.h | 7 | ||||
| -rw-r--r-- | src/core/loader/loader.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/gpu_thread.cpp | 4 |
7 files changed, 28 insertions, 39 deletions
diff --git a/src/common/concepts.h b/src/common/concepts.h index 61df1d32a2..4c07443bac 100644 --- a/src/common/concepts.h +++ b/src/common/concepts.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -12,24 +15,4 @@ namespace Common { template <typename T> concept IsContiguousContainer = std::contiguous_iterator<typename T::iterator>; -// TODO: Replace with std::derived_from when the <concepts> header -// is available on all supported platforms. -template <typename Derived, typename Base> -concept DerivedFrom = requires { - std::is_base_of_v<Base, Derived>; - std::is_convertible_v<const volatile Derived*, const volatile Base*>; - }; - -// TODO: Replace with std::convertible_to when libc++ implements it. -template <typename From, typename To> -concept ConvertibleTo = std::is_convertible_v<From, To>; - -// No equivalents in the stdlib - -template <typename T> -concept IsArithmetic = std::is_arithmetic_v<T>; - -template <typename T> -concept IsIntegral = std::is_integral_v<T>; - } // namespace Common diff --git a/src/common/fixed_point.h b/src/common/fixed_point.h index b0f3ae2ccb..c52c870812 100644 --- a/src/common/fixed_point.h +++ b/src/common/fixed_point.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: 2015 Evan Teran // SPDX-License-Identifier: MIT @@ -16,6 +19,10 @@ namespace Common { +// No equivalent for "std::arithmetic" in the stdlib +template <typename T> +concept IsArithmetic = std::is_arithmetic_v<T>; + template <size_t I, size_t F> class FixedPoint; @@ -392,13 +399,13 @@ public: // binary math operators, effects underlying bit pattern since these return *this; } - template <IsIntegral Integer> + template <std::integral Integer> constexpr FixedPoint& operator>>=(Integer n) { data_ >>= n; return *this; } - template <IsIntegral Integer> + template <std::integral Integer> constexpr FixedPoint& operator<<=(Integer n) { data_ <<= n; return *this; @@ -587,12 +594,12 @@ constexpr FixedPoint<I, F> operator/(Number lhs, FixedPoint<I, F> rhs) { } // shift operators -template <size_t I, size_t F, IsIntegral Integer> +template <size_t I, size_t F, std::integral Integer> constexpr FixedPoint<I, F> operator<<(FixedPoint<I, F> lhs, Integer rhs) { lhs <<= rhs; return lhs; } -template <size_t I, size_t F, IsIntegral Integer> +template <size_t I, size_t F, std::integral Integer> constexpr FixedPoint<I, F> operator>>(FixedPoint<I, F> lhs, Integer rhs) { lhs >>= rhs; return lhs; diff --git a/src/core/file_sys/fs_path_utility.h b/src/core/file_sys/fs_path_utility.h index 9b6addb64f..a18b54437c 100644 --- a/src/core/file_sys/fs_path_utility.h +++ b/src/core/file_sys/fs_path_utility.h @@ -63,12 +63,10 @@ constexpr bool IsInvalidCharacter(char c) { return impl::IsInvalidCharacterImpl<InvalidCharacters, std::size(InvalidCharacters)>(c); } constexpr bool IsInvalidCharacterForHostName(char c) { - return impl::IsInvalidCharacterImpl<InvalidCharactersForHostName, - std::size(InvalidCharactersForHostName)>(c); + return impl::IsInvalidCharacterImpl<InvalidCharactersForHostName, std::size(InvalidCharactersForHostName)>(c); } constexpr bool IsInvalidCharacterForMountName(char c) { - return impl::IsInvalidCharacterImpl<InvalidCharactersForMountName, - std::size(InvalidCharactersForMountName)>(c); + return impl::IsInvalidCharacterImpl<InvalidCharactersForMountName, std::size(InvalidCharactersForMountName)>(c); } } // namespace StringTraits diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index 99347b5aef..89a0c5bbea 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h @@ -15,7 +15,6 @@ #include "common/alignment.h" #include "common/assert.h" #include "common/common_types.h" -#include "common/concepts.h" namespace Kernel { @@ -24,7 +23,7 @@ class KThread; template <typename T> concept KPriorityQueueAffinityMask = ! std::is_reference_v<T>&& requires(T& t) { - { t.GetAffinityMask() } -> Common::ConvertibleTo<u64>; + { t.GetAffinityMask() } -> std::convertible_to<u64>; { t.SetAffinityMask(0) }; { t.GetAffinity(0) } -> std::same_as<bool>; @@ -50,9 +49,9 @@ std::is_reference_v<T>&& requires(T& t) { std::remove_cvref_t<decltype(t.GetAffinityMask())>() } -> KPriorityQueueAffinityMask; - { t.GetActiveCore() } -> Common::ConvertibleTo<s32>; - { t.GetPriority() } -> Common::ConvertibleTo<s32>; - { t.IsDummyThread() } -> Common::ConvertibleTo<bool>; + { t.GetActiveCore() } -> std::convertible_to<s32>; + { t.GetPriority() } -> std::convertible_to<s32>; + { t.IsDummyThread() } -> std::convertible_to<bool>; }; template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority> diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index 32c218638d..d5f372b97d 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -8,8 +11,8 @@ #include <mutex> #include <string> #include <unordered_map> +#include <concepts> -#include "common/concepts.h" #include "core/hle/kernel/k_port.h" #include "core/hle/kernel/svc.h" #include "core/hle/result.h" @@ -63,7 +66,7 @@ public: Result UnregisterService(const std::string& name); Result GetServicePort(Kernel::KClientPort** out_client_port, const std::string& name); - template <Common::DerivedFrom<SessionRequestHandler> T> + template <std::derived_from<SessionRequestHandler> T> std::shared_ptr<T> GetService(const std::string& service_name, bool block = false) const { auto service = registered_services.find(service_name); if (service == registered_services.end() && !block) { diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 1f0bc4d2c1..4379634d03 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -8,6 +8,7 @@ #include <optional> #include <ostream> #include <string> +#include <concepts> #include "common/concepts.h" #include "common/fs/path_util.h" #include "common/logging/log.h" @@ -27,7 +28,7 @@ namespace Loader { namespace { -template <Common::DerivedFrom<AppLoader> T> +template <std::derived_from<AppLoader> T> std::optional<FileType> IdentifyFileLoader(FileSys::VirtualFile file) { const auto file_type = T::IdentifyType(file); if (file_type != FileType::Error) { diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index 8739905d99..af09365ec6 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp @@ -23,9 +23,7 @@ namespace VideoCommon::GPUThread { static void RunThread(std::stop_token stop_token, Core::System& system, VideoCore::RendererBase& renderer, Core::Frontend::GraphicsContext& context, Tegra::Control::Scheduler& scheduler, SynchState& state) { - std::string name = "GPU"; - - Common::SetCurrentThreadName(name.c_str()); + Common::SetCurrentThreadName("GPU"); Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical); system.RegisterHostThread(); |
