From 252cf0c681bd14cf7cd5dfae229221fc73b80bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dziepak?= Date: Tue, 31 Jul 2018 13:34:15 +0100 Subject: [PATCH] utils: crc: accept FragmentRange --- utils/crc.hh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/crc.hh b/utils/crc.hh index 42f3a27c2c..167cad1a3c 100644 --- a/utils/crc.hh +++ b/utils/crc.hh @@ -34,6 +34,8 @@ #include #endif +#include "utils/fragment_range.hh" + namespace utils { class crc32 { @@ -162,6 +164,16 @@ public: _r = ::crc32(_r, in, size); } #endif + + template + GCC6_CONCEPT(requires FragmentRange) + void process_fragmented(const FragmentedBuffer& buffer) { + using boost::range::for_each; + for_each(buffer, [this] (bytes_view bv) { + process(reinterpret_cast(bv.data()), bv.size()); + }); + } + uint32_t get() const { return _r; }