diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-02-13 17:01:44 -0400 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2020-02-13 19:10:33 -0400 |
commit | 2bc949628dfa2efe9a18660b9d662e2a25cef9f9 (patch) | |
tree | 84b72d7b0fcf8838c34c9ae0943dc297fa539e5b /src/core/hardware_properties.h | |
parent | 1e6f8aba04b7be0f90b97aed2527558c755935d6 (diff) |
Core: Address Feedback
Diffstat (limited to 'src/core/hardware_properties.h')
-rw-r--r-- | src/core/hardware_properties.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/core/hardware_properties.h b/src/core/hardware_properties.h index 62cdf9ef04..947140efb7 100644 --- a/src/core/hardware_properties.h +++ b/src/core/hardware_properties.h @@ -8,14 +8,6 @@ namespace Core { -union EmuThreadHandle { - u64 raw; - struct { - u32 host_handle; - u32 guest_handle; - }; -}; - namespace Hardware { // The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz @@ -23,6 +15,29 @@ namespace Hardware { constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch cpu frequency is 1020MHz un/docked constexpr u64 CNTFREQ = 19200000; // Switch's hardware clock speed constexpr u32 NUM_CPU_CORES = 4; // Number of CPU Cores + } // namespace Hardware +struct EmuThreadHandle { + u32 host_handle; + u32 guest_handle; + + u64 GetRaw() const { + return (static_cast<u64>(host_handle) << 32) | guest_handle; + } + + bool operator==(const EmuThreadHandle& rhs) const { + return std::tie(host_handle, guest_handle) == std::tie(rhs.host_handle, rhs.guest_handle); + } + + bool operator!=(const EmuThreadHandle& rhs) const { + return !operator==(rhs); + } + + static constexpr EmuThreadHandle InvalidHandle() { + constexpr u32 invalid_handle = 0xFFFFFFFF; + return {invalid_handle, invalid_handle}; + } +}; + } // namespace Core |