From f2271538d3e1df21718e59982457ed7875b1dad2 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 12 May 2020 11:51:32 -0500 Subject: [PATCH] common/rabin: add helper set_target_bits() Sets key chunking parameters in one easy call. Signed-off-by: Sage Weil --- src/common/rabin.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/rabin.h b/src/common/rabin.h index 795d8aed7df..163610ee197 100644 --- a/src/common/rabin.h +++ b/src/common/rabin.h @@ -75,6 +75,12 @@ public: num_bits = bits; } + // most users should use this + void set_target_bits(int bits, int windowbits = 2) { + set_numbits(bits); + set_min_chunk(1 << (bits - windowbits)); + set_max_chunk(1 << (bits + windowbits)); + } private: bool end_of_chunk(const uint64_t fp , int numbits); -- 2.39.5