From a3807283c6246dbf9d68e66f48e2be93640261a7 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Fri, 31 Jan 2025 01:41:03 -0500 Subject: [PATCH] Comment on hashmap header optimal indexing. --- include/bitcoin/database/impl/primitives/hashhead.ipp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/bitcoin/database/impl/primitives/hashhead.ipp b/include/bitcoin/database/impl/primitives/hashhead.ipp index d041c3df..eba5a9a5 100644 --- a/include/bitcoin/database/impl/primitives/hashhead.ipp +++ b/include/bitcoin/database/impl/primitives/hashhead.ipp @@ -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]. } }