scripted-diff: rename MapIntoRange to FastRange64

-BEGIN VERIFY SCRIPT-
sed -i -e 's/MapIntoRange/FastRange64/' src/blockfilter.cpp src/test/fuzz/golomb_rice.cpp src/util/fastrange.h
-END VERIFY SCRIPT-
pull/23994/head
Pieter Wuille 3 years ago
parent c6d15c45d9
commit 96ecd6fa3e

@ -29,7 +29,7 @@ uint64_t GCSFilter::HashToRange(const Element& element) const
uint64_t hash = CSipHasher(m_params.m_siphash_k0, m_params.m_siphash_k1) uint64_t hash = CSipHasher(m_params.m_siphash_k0, m_params.m_siphash_k1)
.Write(element.data(), element.size()) .Write(element.data(), element.size())
.Finalize(); .Finalize();
return MapIntoRange(hash, m_F); return FastRange64(hash, m_F);
} }
std::vector<uint64_t> GCSFilter::BuildHashedSet(const ElementSet& elements) const std::vector<uint64_t> GCSFilter::BuildHashedSet(const ElementSet& elements) const

@ -25,7 +25,7 @@ uint64_t HashToRange(const std::vector<uint8_t>& element, const uint64_t f)
const uint64_t hash = CSipHasher(0x0706050403020100ULL, 0x0F0E0D0C0B0A0908ULL) const uint64_t hash = CSipHasher(0x0706050403020100ULL, 0x0F0E0D0C0B0A0908ULL)
.Write(element.data(), element.size()) .Write(element.data(), element.size())
.Finalize(); .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) std::vector<uint64_t> BuildHashedSet(const std::unordered_set<std::vector<uint8_t>, ByteVectorHash>& elements, const uint64_t f)

@ -12,7 +12,7 @@
// x * n. // x * n.
// //
// See: https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ // See: https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
static inline uint64_t MapIntoRange(uint64_t x, uint64_t n) static inline uint64_t FastRange64(uint64_t x, uint64_t n)
{ {
#ifdef __SIZEOF_INT128__ #ifdef __SIZEOF_INT128__
return (static_cast<unsigned __int128>(x) * static_cast<unsigned __int128>(n)) >> 64; return (static_cast<unsigned __int128>(x) * static_cast<unsigned __int128>(n)) >> 64;

Loading…
Cancel
Save