From: Sage Weil Date: Tue, 12 May 2020 16:51:32 +0000 (-0500) Subject: common/rabin: add helper set_target_bits() X-Git-Tag: v16.1.0~2230^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f2271538d3e1df21718e59982457ed7875b1dad2;p=ceph.git common/rabin: add helper set_target_bits() Sets key chunking parameters in one easy call. Signed-off-by: Sage Weil --- diff --git a/src/common/rabin.h b/src/common/rabin.h index 795d8aed7df23..163610ee19761 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);