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< ...@@ -1504,8 +1504,10 @@ struct hasher<
// suitable hash of T. Something like absl::is_uniquely_represented<T> // suitable hash of T. Something like absl::is_uniquely_represented<T>
// would be better. std::is_pod is not enough, because POD types // would be better. std::is_pod is not enough, because POD types
// can contain pointers and padding. Also, floating point numbers // can contain pointers and padding. Also, floating point numbers
// may be == without being bit-identical. // may be == without being bit-identical. size_t is less than 64
return hash::SpookyHashV2::Hash64(r.begin(), r.size() * sizeof(T), 0); // 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