From 96ecd6fa3e0f53c3a25eb7c328220b819f8dde03 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 6 Jan 2022 11:29:08 -0500 Subject: [PATCH] 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- --- src/blockfilter.cpp | 2 +- src/test/fuzz/golomb_rice.cpp | 2 +- src/util/fastrange.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/blockfilter.cpp b/src/blockfilter.cpp index 566254d8399..63a9ba498f5 100644 --- a/src/blockfilter.cpp +++ b/src/blockfilter.cpp @@ -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) .Write(element.data(), element.size()) .Finalize(); - return MapIntoRange(hash, m_F); + return FastRange64(hash, m_F); } std::vector GCSFilter::BuildHashedSet(const ElementSet& elements) const diff --git a/src/test/fuzz/golomb_rice.cpp b/src/test/fuzz/golomb_rice.cpp index 2d0b29953c6..b4bb4c6dc64 100644 --- a/src/test/fuzz/golomb_rice.cpp +++ b/src/test/fuzz/golomb_rice.cpp @@ -25,7 +25,7 @@ uint64_t HashToRange(const std::vector& 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 BuildHashedSet(const std::unordered_set, ByteVectorHash>& elements, const uint64_t f) diff --git a/src/util/fastrange.h b/src/util/fastrange.h index 57bb8e07dc4..963d21c03af 100644 --- a/src/util/fastrange.h +++ b/src/util/fastrange.h @@ -12,7 +12,7 @@ // x * n. // // 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__ return (static_cast(x) * static_cast(n)) >> 64;