Commit 6bdbdb6f authored by Nathan Bronson's avatar Nathan Bronson Committed by Facebook GitHub Bot

add explicit cast for narrowing on 32-bit platforms

Summary:
folly::Hash<Range<T>> uses SpookyHashV2::Hash64 (for integral
T). On 32-bit platforms we need an explicit cast to avoid a narrowing
warning when converting this to size_t.

(Note: this ignores all push blocking failures!)

Reviewed By: shixiao

Differential Revision: D21491467

fbshipit-source-id: 1cbd05553c61b8dccb664ec4478cfb0b049dc5b5
parent 780050d9
......@@ -1504,8 +1504,10 @@ struct hasher<
// suitable hash of T. Something like absl::is_uniquely_represented<T>
// would be better. std::is_pod is not enough, because POD types
// can contain pointers and padding. Also, floating point numbers
// may be == without being bit-identical.
return hash::SpookyHashV2::Hash64(r.begin(), r.size() * sizeof(T), 0);
// may be == without being bit-identical. size_t is less than 64
// bits on some platforms.
return static_cast<size_t>(
hash::SpookyHashV2::Hash64(r.begin(), r.size() * sizeof(T), 0));
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment