mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-06 03:02:37 +02:00
Merge bitcoin/bitcoin#23994: Consolidate all uses of the fast range mapping technique in util/fastrange.h
efab28b06bAdd FastRange32 function and use it throughout the codebase (Pieter Wuille)96ecd6fa3escripted-diff: rename MapIntoRange to FastRange64 (Pieter Wuille)c6d15c45d9[moveonly] Move MapIntoRange() to separate util/fastrange.h (Pieter Wuille) Pull request description: Several places in the codebase use the fast range mapping technique described in https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/, some for 32-bit ranges, some for 64-bit ones. Move all of these to `util/fastrange.h`, and give them a consistent name. ACKs for top commit: Sjors: ACKefab28b06bshaavan: reACKefab28b06bMarcoFalke: review ACKefab28b06b🍸 Tree-SHA512: 3190a25ef21d17f0ab2afcd9b8d5a1813fdfac0d93996878017e84ff62eee412c823d6149ae8e92cfc3214458641e83ace4b022b4a0fe0679f78dbaee21c6227
This commit is contained in:
@@ -25,7 +25,7 @@ uint64_t HashToRange(const std::vector<uint8_t>& element, const uint64_t f)
|
||||
const uint64_t hash = CSipHasher(0x0706050403020100ULL, 0x0F0E0D0C0B0A0908ULL)
|
||||
.Write(element.data(), element.size())
|
||||
.Finalize();
|
||||
return MapIntoRange(hash, f);
|
||||
return FastRange64(hash, f);
|
||||
}
|
||||
|
||||
std::vector<uint64_t> BuildHashedSet(const std::unordered_set<std::vector<uint8_t>, ByteVectorHash>& elements, const uint64_t f)
|
||||
|
||||
Reference in New Issue
Block a user