Add folly::hasher support for floating point types
Summary: Move `folly::hasher` closer to feature parity with `std::hash`. This is in order to replace some instances of `folly::hash::hash_combine(...)` with `folly::Hash()(...)` (`std::hash` is the identity for integers, which makes it an unsafe default for more sophisticated hash data structures, including open-addressing hash tables). The implementation is similar to `libstdc++`'s implementation, in that we handle separately the `0` case, because `0` and `-0` have different binary representations but are equal according to `operator==`, and hash the bytes otherwise. It is probably a little faster than `libstdc++`'s implementation, that delegates a out-of-line Murmur hash routine for arbitrary buffers, while this uses a minimal inlineable machine word hashing routine. Reviewed By: yfeldblum Differential Revision: D6410713 fbshipit-source-id: 86d9e4ed8da04fffe283949825852e539ec7d5cf
Showing
Please register or sign in to comment