diff options
| author | Lioncash <mai.iam2048@gmail.com> | 2024-01-31 12:37:41 -0500 |
|---|---|---|
| committer | Lioncash <mai.iam2048@gmail.com> | 2024-01-31 12:37:44 -0500 |
| commit | 5bfaa3a966f01301ca8e856963628c6fdf68cb7d (patch) | |
| tree | 860b80af21d8beaaadca94b08a7b1cb3487d5ff2 /Source/Core | |
| parent | 30fdf25f8f3a2fd217c8c39eb3abb5b55f63b510 (diff) | |
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.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/VideoCommon/NativeVertexFormat.h | 12 |
1 files 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<PortableVertexDeclaration>, "Make sure we can memset-initialize"); -namespace std -{ template <> -struct hash<PortableVertexDeclaration> +struct std::hash<PortableVertexDeclaration> { // Implementation from Wikipedia. template <typename T> - 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<PortableVertexDeclaration> 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. |
