Skip to content

Commit

Permalink
Use string_view for fnv64
Browse files Browse the repository at this point in the history
Summary: Avoid the need for a temporary std::string if fnv64 happens to be called with a C-string literal.

Reviewed By: ot, ilvokhin

Differential Revision: D67716872

fbshipit-source-id: 3e8877955c9d9dbe43db3a97376397df5016d992
  • Loading branch information
marksantaniello authored and facebook-github-bot committed Jan 2, 2025
1 parent 7fad06e commit 1392864
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion folly/hash/Hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ constexpr uint64_t fnv64(
* @methodset fnv
*/
inline uint64_t fnv64(
const std::string& str, uint64_t hash = fnv64_hash_start) noexcept {
std::string_view str, uint64_t hash = fnv64_hash_start) noexcept {
return fnv64_buf(str.data(), str.size(), hash);
}

Expand Down

0 comments on commit 1392864

Please sign in to comment.