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.
This commit is contained in:
parent
30fdf25f8f
commit
5bfaa3a966
|
@ -79,14 +79,12 @@ struct PortableVertexDeclaration
|
||||||
static_assert(std::is_trivially_copyable_v<PortableVertexDeclaration>,
|
static_assert(std::is_trivially_copyable_v<PortableVertexDeclaration>,
|
||||||
"Make sure we can memset-initialize");
|
"Make sure we can memset-initialize");
|
||||||
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
template <>
|
template <>
|
||||||
struct hash<PortableVertexDeclaration>
|
struct std::hash<PortableVertexDeclaration>
|
||||||
{
|
{
|
||||||
// Implementation from Wikipedia.
|
// Implementation from Wikipedia.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
u32 Fletcher32(const T& data) const
|
static u32 Fletcher32(const T& data)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(T) % sizeof(u16) == 0);
|
static_assert(sizeof(T) % sizeof(u16) == 0);
|
||||||
|
|
||||||
|
@ -114,9 +112,11 @@ struct hash<PortableVertexDeclaration>
|
||||||
sum2 = (sum2 & 0xffff) + (sum2 >> 16);
|
sum2 = (sum2 & 0xffff) + (sum2 >> 16);
|
||||||
return (sum2 << 16 | sum1);
|
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
|
// The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp
|
||||||
// is in the respective backend, not here in VideoCommon.
|
// is in the respective backend, not here in VideoCommon.
|
||||||
|
|
Loading…
Reference in New Issue