diff --git a/Source/Core/VideoCommon/NativeVertexFormat.h b/Source/Core/VideoCommon/NativeVertexFormat.h index 597f492e9e..0f6be25541 100644 --- a/Source/Core/VideoCommon/NativeVertexFormat.h +++ b/Source/Core/VideoCommon/NativeVertexFormat.h @@ -79,14 +79,12 @@ struct PortableVertexDeclaration static_assert(std::is_trivially_copyable_v, "Make sure we can memset-initialize"); -namespace std -{ template <> -struct hash +struct std::hash { // Implementation from Wikipedia. template - u32 Fletcher32(const T& data) const + static u32 Fletcher32(const T& data) { static_assert(sizeof(T) % sizeof(u16) == 0); @@ -114,9 +112,11 @@ struct hash sum2 = (sum2 & 0xffff) + (sum2 >> 16); return (sum2 << 16 | sum1); } - size_t operator()(const PortableVertexDeclaration& decl) const { return Fletcher32(decl); } + size_t operator()(const PortableVertexDeclaration& decl) const noexcept + { + return Fletcher32(decl); + } }; -} // namespace std // The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp // is in the respective backend, not here in VideoCommon. diff --git a/Source/Core/VideoCommon/RenderState.h b/Source/Core/VideoCommon/RenderState.h index 8e0902b88e..4a682b1a0f 100644 --- a/Source/Core/VideoCommon/RenderState.h +++ b/Source/Core/VideoCommon/RenderState.h @@ -220,17 +220,14 @@ struct SamplerState TM1 tm1; }; -namespace std -{ template <> -struct hash +struct std::hash { - std::size_t operator()(SamplerState const& state) const noexcept + std::size_t operator()(const SamplerState& state) const noexcept { return std::hash{}(state.Hex()); } }; -} // namespace std namespace RenderState { diff --git a/Source/Core/VideoCommon/TextureConfig.h b/Source/Core/VideoCommon/TextureConfig.h index 462b3dddff..4e3976f938 100644 --- a/Source/Core/VideoCommon/TextureConfig.h +++ b/Source/Core/VideoCommon/TextureConfig.h @@ -79,10 +79,8 @@ struct TextureConfig AbstractTextureType type = AbstractTextureType::Texture_2DArray; }; -namespace std -{ template <> -struct hash +struct std::hash { using argument_type = TextureConfig; using result_type = size_t; @@ -95,4 +93,3 @@ struct hash return std::hash{}(id); } }; -} // namespace std diff --git a/Source/Core/VideoCommon/VertexLoaderBase.h b/Source/Core/VideoCommon/VertexLoaderBase.h index 26d6f3ff2e..451f035793 100644 --- a/Source/Core/VideoCommon/VertexLoaderBase.h +++ b/Source/Core/VideoCommon/VertexLoaderBase.h @@ -46,14 +46,11 @@ private: } }; -namespace std -{ template <> -struct hash +struct std::hash { - size_t operator()(const VertexLoaderUID& uid) const { return uid.GetHash(); } + size_t operator()(const VertexLoaderUID& uid) const noexcept { return uid.GetHash(); } }; -} // namespace std class VertexLoaderBase {