forked from Imagelibrary/binutils-gdb
Tweak the std::hash<> specialization for aarch64_features.
Move the specialization into an explicit std namespace to workaround a bug in older compilers. GCC 6.4.1 at least fails to compile the previous version with the following error: gdb/arch/aarch64.h:48:13: error: specialization of 'template<class _Tp> struct std::hash' in different namespace [-fpermissive] struct std::hash<aarch64_features>
This commit is contained in:
@@ -44,20 +44,23 @@ inline bool operator==(const aarch64_features &lhs, const aarch64_features &rhs)
|
|||||||
&& lhs.tls == rhs.tls;
|
&& lhs.tls == rhs.tls;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
namespace std
|
||||||
struct std::hash<aarch64_features>
|
|
||||||
{
|
{
|
||||||
std::size_t operator()(const aarch64_features &features) const noexcept
|
template<>
|
||||||
|
struct hash<aarch64_features>
|
||||||
{
|
{
|
||||||
std::size_t h;
|
std::size_t operator()(const aarch64_features &features) const noexcept
|
||||||
|
{
|
||||||
|
std::size_t h;
|
||||||
|
|
||||||
h = features.vq;
|
h = features.vq;
|
||||||
h = h << 1 | features.pauth;
|
h = h << 1 | features.pauth;
|
||||||
h = h << 1 | features.mte;
|
h = h << 1 | features.mte;
|
||||||
h = h << 1 | features.tls;
|
h = h << 1 | features.tls;
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the aarch64 target description. */
|
/* Create the aarch64 target description. */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user