diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2022-06-27 15:07:02 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-01 11:27:43 +0000 |
commit | 493aee25dd07ae0df8a6ab13cd51197f82c82325 (patch) | |
tree | 905e27d616d5dfee0bf14306fa074d38f6504539 /fuzz | |
parent | aeda14dfdf7508f63be00dfcc97e16315e94af20 (diff) | |
download | chrome-ec-493aee25dd07ae0df8a6ab13cd51197f82c82325.tar.gz |
fuzz/span.h: Format with clang-format
BUG=b:236386294
BRANCH=none
TEST=none
Change-Id: I4838e507f8714cab66d3433306a18fd835cc93b2
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730195
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'fuzz')
-rw-r--r-- | fuzz/span.h | 92 |
1 files changed, 60 insertions, 32 deletions
diff --git a/fuzz/span.h b/fuzz/span.h index 531df832a3..f4ed0ff7ed 100644 --- a/fuzz/span.h +++ b/fuzz/span.h @@ -9,48 +9,76 @@ #include <algorithm> -namespace fuzz { +namespace fuzz +{ -template <typename T> -class span { - public: - typedef T value_type; +template <typename T> class span { + public: + typedef T value_type; - constexpr span() : span<T>(nullptr, nullptr) {} - constexpr span(T* begin, size_t size) : begin_(begin), end_(begin + size) {} - constexpr span(T* begin, T* end) : begin_(begin), end_(end) {} + constexpr span() + : span<T>(nullptr, nullptr) + { + } + constexpr span(T *begin, size_t size) + : begin_(begin) + , end_(begin + size) + { + } + constexpr span(T *begin, T *end) + : begin_(begin) + , end_(end) + { + } - template <class Container> - constexpr span(Container& container) - : begin_(container.begin()), end_(container.end()){}; + template <class Container> + constexpr span(Container &container) + : begin_(container.begin()) + , end_(container.end()){}; - constexpr T* begin() const { return begin_; } - constexpr T* end() const { return end_; } + constexpr T *begin() const + { + return begin_; + } + constexpr T *end() const + { + return end_; + } - constexpr T* data() const { return begin_; } + constexpr T *data() const + { + return begin_; + } - constexpr bool empty() const { return begin_ == end_; } - constexpr size_t size() const { return end_ - begin_; } + constexpr bool empty() const + { + return begin_ == end_; + } + constexpr size_t size() const + { + return end_ - begin_; + } - private: - T* begin_; - T* end_; + private: + T *begin_; + T *end_; }; template <typename Source, typename Destination> -size_t CopyWithPadding(Source source, - Destination destination, - typename Destination::value_type fill_value) { - if (source.size() >= destination.size()) { - std::copy(source.begin(), source.begin() + destination.size(), - destination.begin()); - return destination.size(); - } - std::copy(source.begin(), source.end(), destination.begin()); - std::fill(destination.begin() + source.size(), destination.end(), fill_value); - return source.size(); +size_t CopyWithPadding(Source source, Destination destination, + typename Destination::value_type fill_value) +{ + if (source.size() >= destination.size()) { + std::copy(source.begin(), source.begin() + destination.size(), + destination.begin()); + return destination.size(); + } + std::copy(source.begin(), source.end(), destination.begin()); + std::fill(destination.begin() + source.size(), destination.end(), + fill_value); + return source.size(); } -} // namespace fuzz +} // namespace fuzz -#endif // __FUZZ_SPAN_H +#endif // __FUZZ_SPAN_H |