diff options
author | bunnei <bunneidev@gmail.com> | 2020-12-05 08:50:32 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2020-12-06 09:27:13 +0100 |
commit | 4d3be1816c9f1ac5c49906c8466fa2618ea15e73 (patch) | |
tree | 7e7114e094229730c250a54c3bdc8e86001498c9 /src/core | |
parent | hle: kernel: GlobalSchedulerContext: Various style fixes based on code review feedback. (diff) | |
download | yuzu-4d3be1816c9f1ac5c49906c8466fa2618ea15e73.tar yuzu-4d3be1816c9f1ac5c49906c8466fa2618ea15e73.tar.gz yuzu-4d3be1816c9f1ac5c49906c8466fa2618ea15e73.tar.bz2 yuzu-4d3be1816c9f1ac5c49906c8466fa2618ea15e73.tar.lz yuzu-4d3be1816c9f1ac5c49906c8466fa2618ea15e73.tar.xz yuzu-4d3be1816c9f1ac5c49906c8466fa2618ea15e73.tar.zst yuzu-4d3be1816c9f1ac5c49906c8466fa2618ea15e73.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/kernel/k_affinity_mask.h | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/core/hle/kernel/k_affinity_mask.h b/src/core/hle/kernel/k_affinity_mask.h index fa2a720a4..dd73781cd 100644 --- a/src/core/hle/kernel/k_affinity_mask.h +++ b/src/core/hle/kernel/k_affinity_mask.h @@ -14,24 +14,10 @@ namespace Kernel { class KAffinityMask { -private: - static constexpr u64 AllowedAffinityMask = (1ul << Core::Hardware::NUM_CPU_CORES) - 1; - -private: - u64 mask; - -private: - static constexpr u64 GetCoreBit(s32 core) { - ASSERT(0 <= core && core < static_cast<s32>(Core::Hardware::NUM_CPU_CORES)); - return (1ull << core); - } - public: - constexpr KAffinityMask() : mask(0) { - ASSERT(this); - } + constexpr KAffinityMask() = default; - constexpr u64 GetAffinityMask() const { + [[nodiscard]] constexpr u64 GetAffinityMask() const { return this->mask; } @@ -40,7 +26,7 @@ public: this->mask = new_mask; } - constexpr bool GetAffinity(s32 core) const { + [[nodiscard]] constexpr bool GetAffinity(s32 core) const { return this->mask & GetCoreBit(core); } @@ -57,6 +43,16 @@ public: constexpr void SetAll() { this->mask = AllowedAffinityMask; } + +private: + [[nodiscard]] static constexpr u64 GetCoreBit(s32 core) { + ASSERT(0 <= core && core < static_cast<s32>(Core::Hardware::NUM_CPU_CORES)); + return (1ULL << core); + } + + static constexpr u64 AllowedAffinityMask = (1ULL << Core::Hardware::NUM_CPU_CORES) - 1; + + u64 mask{}; }; } // namespace Kernel |