Skip to content
Snippets Groups Projects
Commit 4f4bf99f authored by Giovanna Lazzari Miotto's avatar Giovanna Lazzari Miotto Committed by Jakob Blomer
Browse files

[ntuple,daos] Cast variable to preclude warning in 32-bit

Replace a variable's type from `size_t` to `uint64_t`
to avoid warnings on 32-bit platforms.

The variable is the output of a hashing function and
undergoes shifting by 32 bits as the seeding step of
a hash combination between the two-halves of a
64-bit value.

The change has no functional impact.
parent 4483b01b
No related branches found
No related tags found
No related merge requests found
...@@ -115,8 +115,8 @@ struct RDaosContainerNTupleLocator { ...@@ -115,8 +115,8 @@ struct RDaosContainerNTupleLocator {
static ntuple_index_t Hash(const std::string &ntupleName) static ntuple_index_t Hash(const std::string &ntupleName)
{ {
// Convert string to numeric representation via `std::hash`. // Convert string to numeric representation via `std::hash`.
std::size_t h = std::hash<std::string>{}(ntupleName); uint64_t h = std::hash<std::string>{}(ntupleName);
// Fold `std::size_t` bits into 32-bit using `boost::hash_combine()` algorithm and magic number. // Fold the hash into 32-bit using `boost::hash_combine()` algorithm and magic number.
auto seed = static_cast<uint32_t>(h >> 32); auto seed = static_cast<uint32_t>(h >> 32);
seed ^= static_cast<uint32_t>(h & 0xffffffff) + 0x9e3779b9 + (seed << 6) + (seed >> 2); seed ^= static_cast<uint32_t>(h & 0xffffffff) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
auto hash = static_cast<ntuple_index_t>(seed); auto hash = static_cast<ntuple_index_t>(seed);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment