diff --git a/Source/Core/Common/BitSet.h b/Source/Core/Common/BitSet.h index f8506e7c89..4425b6067c 100644 --- a/Source/Core/Common/BitSet.h +++ b/Source/Core/Common/BitSet.h @@ -5,14 +5,14 @@ #include #include #include -#include "CommonTypes.h" - -// Helper functions: +#include "Common/CommonTypes.h" #ifdef _WIN32 #include +namespace Common +{ template constexpr int CountSetBits(T v) { @@ -49,6 +49,8 @@ inline int LeastSignificantSetBit(u64 val) return (int)index; } #else +namespace Common +{ constexpr int CountSetBits(u8 val) { return __builtin_popcount(val); @@ -83,9 +85,6 @@ inline int LeastSignificantSetBit(u64 val) } #endif -// namespace avoids conflict with OS X Carbon; don't use BitSet directly -namespace BS -{ // Similar to std::bitset, this is a class which encapsulates a bitset, i.e. // using the set bits of an integer to represent a set of integers. Like that // class, it acts like an array of bools: @@ -207,9 +206,9 @@ public: constexpr Iterator end() const { return Iterator(m_val, -1); } IntTy m_val; }; -} +} // namespace Common -typedef BS::BitSet BitSet8; -typedef BS::BitSet BitSet16; -typedef BS::BitSet BitSet32; -typedef BS::BitSet BitSet64; +using BitSet8 = Common::BitSet; +using BitSet16 = Common::BitSet; +using BitSet32 = Common::BitSet; +using BitSet64 = Common::BitSet; diff --git a/Source/Core/VideoBackends/D3D/D3DState.cpp b/Source/Core/VideoBackends/D3D/D3DState.cpp index 8a2862479b..25742d2a65 100644 --- a/Source/Core/VideoBackends/D3D/D3DState.cpp +++ b/Source/Core/VideoBackends/D3D/D3DState.cpp @@ -28,8 +28,8 @@ void StateManager::Apply() if (!m_dirtyFlags) return; - int textureMaskShift = LeastSignificantSetBit((u32)DirtyFlag_Texture0); - int samplerMaskShift = LeastSignificantSetBit((u32)DirtyFlag_Sampler0); + const int textureMaskShift = Common::LeastSignificantSetBit((u32)DirtyFlag_Texture0); + const int samplerMaskShift = Common::LeastSignificantSetBit((u32)DirtyFlag_Sampler0); u32 dirtyTextures = (m_dirtyFlags & @@ -105,7 +105,7 @@ void StateManager::Apply() while (dirtyTextures) { - int index = LeastSignificantSetBit(dirtyTextures); + const int index = Common::LeastSignificantSetBit(dirtyTextures); if (m_current.textures[index] != m_pending.textures[index]) { D3D::context->PSSetShaderResources(index, 1, &m_pending.textures[index]); @@ -117,7 +117,7 @@ void StateManager::Apply() while (dirtySamplers) { - int index = LeastSignificantSetBit(dirtySamplers); + const int index = Common::LeastSignificantSetBit(dirtySamplers); if (m_current.samplers[index] != m_pending.samplers[index]) { D3D::context->PSSetSamplers(index, 1, &m_pending.samplers[index]); @@ -187,7 +187,7 @@ void StateManager::SetTextureByMask(u32 textureSlotMask, ID3D11ShaderResourceVie { while (textureSlotMask) { - int index = LeastSignificantSetBit(textureSlotMask); + const int index = Common::LeastSignificantSetBit(textureSlotMask); SetTexture(index, srv); textureSlotMask &= ~(1 << index); }