mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Merge pull request #7492 from MerryMage/regcache2
JitRegCache: Refactor register cache
This commit is contained in:
@ -193,10 +193,14 @@ public:
|
||||
constexpr BitSet operator&(BitSet other) const { return BitSet(m_val & other.m_val); }
|
||||
constexpr BitSet operator^(BitSet other) const { return BitSet(m_val ^ other.m_val); }
|
||||
constexpr BitSet operator~() const { return BitSet(~m_val); }
|
||||
constexpr BitSet operator<<(IntTy shift) const { return BitSet(m_val << shift); }
|
||||
constexpr BitSet operator>>(IntTy shift) const { return BitSet(m_val >> shift); }
|
||||
constexpr explicit operator bool() const { return m_val != 0; }
|
||||
BitSet& operator|=(BitSet other) { return *this = *this | other; }
|
||||
BitSet& operator&=(BitSet other) { return *this = *this & other; }
|
||||
BitSet& operator^=(BitSet other) { return *this = *this ^ other; }
|
||||
BitSet& operator<<=(IntTy shift) { return *this = *this << shift; }
|
||||
BitSet& operator>>=(IntTy shift) { return *this = *this >> shift; }
|
||||
// Warning: Even though on modern CPUs this is a single fast instruction,
|
||||
// Dolphin's official builds do not currently assume POPCNT support on x86,
|
||||
// so slower explicit bit twiddling is generated. Still should generally
|
||||
|
@ -159,6 +159,7 @@
|
||||
<ClInclude Include="TraversalClient.h" />
|
||||
<ClInclude Include="TraversalProto.h" />
|
||||
<ClInclude Include="UPnP.h" />
|
||||
<ClInclude Include="VariantUtil.h" />
|
||||
<ClInclude Include="Version.h" />
|
||||
<ClInclude Include="WorkQueueThread.h" />
|
||||
<ClInclude Include="x64ABI.h" />
|
||||
|
26
Source/Core/Common/VariantUtil.h
Normal file
26
Source/Core/Common/VariantUtil.h
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2018 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <variant>
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename... From>
|
||||
struct VariantCastProxy
|
||||
{
|
||||
const std::variant<From...>& v;
|
||||
|
||||
template <typename... To>
|
||||
operator std::variant<To...>() const
|
||||
{
|
||||
return std::visit([](auto&& arg) { return std::variant<To...>{arg}; }, v);
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template <typename... From>
|
||||
auto VariantCast(const std::variant<From...>& v)
|
||||
{
|
||||
return detail::VariantCastProxy<From...>{v};
|
||||
}
|
Reference in New Issue
Block a user