From 5bfaa3a966f01301ca8e856963628c6fdf68cb7d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 31 Jan 2024 12:37:41 -0500 Subject: [PATCH] NativeVertexFormat: Collapse std namespace and mark hash noexcept We can just tag the std:: onto the end of the specialization to make it less noisy. Also mark it as noexcept, since hashes shouldn't throw exceptions. --- Source/Core/VideoCommon/NativeVertexFormat.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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.