From 493aee25dd07ae0df8a6ab13cd51197f82c82325 Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Mon, 27 Jun 2022 15:07:02 -0600 Subject: fuzz/span.h: Format with clang-format BUG=b:236386294 BRANCH=none TEST=none Change-Id: I4838e507f8714cab66d3433306a18fd835cc93b2 Signed-off-by: Jack Rosenthal Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730195 Reviewed-by: Jeremy Bettis --- fuzz/span.h | 92 ++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 32 deletions(-) (limited to 'fuzz/span.h') 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 -namespace fuzz { +namespace fuzz +{ -template -class span { - public: - typedef T value_type; +template class span { + public: + typedef T value_type; - constexpr span() : span(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(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 - constexpr span(Container& container) - : begin_(container.begin()), end_(container.end()){}; + template + 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 -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 -- cgit v1.2.1 From 71b2ef709dcb14260f5fdaa3ab4ced005a29fb46 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 12 Sep 2022 14:54:36 -0400 Subject: Update license boilerplate text in source code files Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis Reviewed-by: Jack Rosenthal --- fuzz/span.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fuzz/span.h') diff --git a/fuzz/span.h b/fuzz/span.h index f4ed0ff7ed..9cb08f9461 100644 --- a/fuzz/span.h +++ b/fuzz/span.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium OS Authors. All rights reserved. +// Copyright 2018 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -- cgit v1.2.1