Skip to content

Commit

Permalink
Comment on hashmap header optimal indexing.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jan 31, 2025
1 parent ac4eaf8 commit a380728
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/bitcoin/database/impl/primitives/hashhead.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ inline Link CLASS::index(const Key& key) const NOEXCEPT
{
// unique_hash assumes sufficient uniqueness in low order key bytes.
return system::unique_hash(key) % buckets_;

// TODO: restrict buckets to power of two and replace modulo above with
// return and(sub1(buckets), unique_hash(key)) [and() is much faster].
}
}

Expand Down

0 comments on commit a380728

Please sign in to comment.