Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/38479 )
Change subject: base: Style fixes in the CircleBuf and Fifo classes.
......................................................................
base: Style fixes in the CircleBuf and Fifo classes.
Change-Id: Ia08548027973e2b18e09bc3f05a6498855bdd7f7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38479
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
---
M src/base/circlebuf.hh
1 file changed, 22 insertions(+), 17 deletions(-)
Approvals:
Daniel Carvalho: Looks good to me, approved
Gabe Black: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/circlebuf.hh b/src/base/circlebuf.hh
index 548e73f..8d7297a 100644
--- a/src/base/circlebuf.hh
+++ b/src/base/circlebuf.hh
@@ -74,7 +74,9 @@
* @param len Number of elements to copy
*/
template <class OutputIterator>
- void peek(OutputIterator out, size_t len) const {
+ void
+ peek(OutputIterator out, size_t len) const
+ {
peek(out, 0, len);
}
@@ -86,9 +88,11 @@
* @param len Number of elements to copy
*/
template <class OutputIterator>
- void peek(OutputIterator out, off_t offset, size_t len) const {
+ void
+ peek(OutputIterator out, off_t offset, size_t len) const
+ {
panic_if(offset + len > size(),
- "Trying to read past end of circular buffer.\n");
+ "Trying to read past end of circular buffer.");
std::copy(begin() + offset, begin() + offset + len, out);
}
@@ -100,7 +104,9 @@
* @param len Number of elements to read
*/
template <class OutputIterator>
- void read(OutputIterator out, size_t len) {
+ void
+ read(OutputIterator out, size_t len)
+ {
peek(out, len);
pop_front(len);
}
@@ -112,7 +118,9 @@
* @param len Number of elements to read
*/
template <class InputIterator>
- void write(InputIterator in, size_t len) {
+ void
+ write(InputIterator in, size_t len)
+ {
// Writes that are larger than the backing store are allowed,
// but only the last part of the buffer will be written.
if (len > capacity()) {
@@ -143,8 +151,7 @@
typedef T value_type;
public:
- Fifo(size_t size)
- : buf(size) {}
+ Fifo(size_t size) : buf(size) {}
bool empty() const { return buf.empty(); }
size_t size() const { return buf.size(); }
@@ -158,9 +165,10 @@
void read(OutputIterator out, size_t len) { buf.read(out, len); }
template <class InputIterator>
- void write(InputIterator in, size_t len) {
- panic_if(size() + len > capacity(),
- "Trying to overfill FIFO buffer.\n");
+ void
+ write(InputIterator in, size_t len)
+ {
+ panic_if(size() + len > capacity(), "Trying to overfill FIFO
buffer.");
buf.write(in, len);
}
@@ -181,8 +189,7 @@
template <typename T>
void
-arrayParamIn(CheckpointIn &cp, const std::string &name,
- CircleBuf<T> ¶m)
+arrayParamIn(CheckpointIn &cp, const std::string &name, CircleBuf<T>
¶m)
{
std::vector<T> temp;
arrayParamIn(cp, name, temp);
@@ -193,8 +200,7 @@
template <typename T>
void
-arrayParamOut(CheckpointOut &cp, const std::string &name,
- const Fifo<T> ¶m)
+arrayParamOut(CheckpointOut &cp, const std::string &name, const Fifo<T>
¶m)
{
std::vector<T> temp(param.size());
param.peek(temp.begin(), temp.size());
@@ -203,14 +209,13 @@
template <typename T>
void
-arrayParamIn(CheckpointIn &cp, const std::string &name,
- Fifo<T> ¶m)
+arrayParamIn(CheckpointIn &cp, const std::string &name, Fifo<T> ¶m)
{
std::vector<T> temp;
arrayParamIn(cp, name, temp);
fatal_if(param.capacity() < temp.size(),
- "Trying to unserialize data into too small FIFO\n");
+ "Trying to unserialize data into too small FIFO");
param.flush();
param.write(temp.cbegin(), temp.size());
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38479
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ia08548027973e2b18e09bc3f05a6498855bdd7f7
Gerrit-Change-Number: 38479
Gerrit-PatchSet: 6
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s