hle: kernel: KAffinityMask: Various style fixes based on code review feedback.

This commit is contained in:
bunnei 2020-12-04 23:50:32 -08:00
parent 357d79fb6e
commit 4d3be1816c
1 changed files with 13 additions and 17 deletions

View File

@ -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