From: Nathan Binkert Date: Fri, 11 May 2007 18:47:18 +0000 (-0700) Subject: total should be the sum of the vector result of an operation, X-Git-Tag: m5_2.0_beta3~4^2~2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d667ce01b488e505569d6dce253f97e4246851cf;p=gem5.git total should be the sum of the vector result of an operation, not sum the operands and then apply the operation. --HG-- extra : convert_revision : 06486e59b3dd9588b458ef45c341cc4f2554dc09 --- diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 761b30c2b..8d3f53d4c 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -2094,9 +2094,13 @@ class UnaryNode : public Node return vresult; } - Result total() const { - Op op; - return op(l->total()); + Result total() const + { + const VResult &vec = this->result(); + Result total = 0; + for (int i = 0; i < size(); i++) + total += vec[i]; + return total; } virtual size_t size() const { return l->size(); } @@ -2149,9 +2153,13 @@ class BinaryNode : public Node return vresult; } - Result total() const { - Op op; - return op(l->total(), r->total()); + Result total() const + { + const VResult &vec = this->result(); + Result total = 0; + for (int i = 0; i < size(); i++) + total += vec[i]; + return total; } virtual size_t size() const {