Skip to content

Commit

Permalink
let F14HashToken equality-comparison skip the tag element
Browse files Browse the repository at this point in the history
Summary: It only needs to compare the hash element and can skip comparing the derived tag element. The derived tag element is indended as a precomputed word to accelerate lookup but only decelerates equality-comparison.

Reviewed By: DenisYaroshevskiy

Differential Revision: D60044472

fbshipit-source-id: 7b18667b993b817b1ce3c78667693f5f12fb48e5
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jul 22, 2024
1 parent 404b94b commit dc5586d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions folly/container/detail/F14Table.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ class F14HashToken final {

friend constexpr bool operator==(
F14HashToken const& a, F14HashToken const& b) noexcept {
return a.hp_ == b.hp_;
return a.hp_.first == b.hp_.first; // processed hash but not tag
}
friend constexpr bool operator!=(
F14HashToken const& a, F14HashToken const& b) noexcept {
return a.hp_ != b.hp_;
return !(a == b);
}

private:
Expand Down

0 comments on commit dc5586d

Please sign in to comment.