Skip to content

Commit

Permalink
Allow for 32 bit builds (GPUOpen-Drivers#2884)
Browse files Browse the repository at this point in the history
The amdllpc unit tests fail for 32 bit builds due to the 64 bit specific code
in vkgcMetroHash (assumptions are made about size_t).

Use compact32 for 32 bit builds instead.
  • Loading branch information
dstutt authored Dec 14, 2023
1 parent 2fcce3b commit 55cd330
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion util/vkgcMetroHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ inline bool operator!=(const Hash &lhs, const Hash &rhs) {
namespace std {
template <> struct hash<MetroHash::Hash> {
// Returns `hash` compacted to `size_t`. Returns zero for value-initialized hashes.
size_t operator()(const MetroHash::Hash &hash) const { return static_cast<size_t>(MetroHash::compact64(&hash)); }
size_t operator()(const MetroHash::Hash &hash) const {
static_assert(sizeof(size_t) == 8 || sizeof(size_t) == 4, "unexpected architecture");
if constexpr (sizeof(size_t) == 8) {
return static_cast<size_t>(MetroHash::compact64(&hash));
} else {
return static_cast<size_t>(MetroHash::compact32(&hash));
}
}
};
} // namespace std

0 comments on commit 55cd330

Please sign in to comment.